I am working on an elixir where project where I have to establish an ssh connection after receiving an http request and validating its content. I am trying to establish an ssh connection using the following commands:
:ssh.start
{:ok, conn} = :ssh.connect('o5108005855.v4.s5.ams.boa.io', 22, [ {:user,<user_name>},{:silently_accept_hosts, true} ], 5000)
I am asked to enter the ssh password and when I do I get: undefined function <password>/0. If someone has come across a similar problem, please share your solution.
After a while of inactivity I get:
17:04:01.359 [error] [69, 114, 108, 97, 110, 103, 32, 115, 115, 104, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 32, 104, 97, 110, 100, 108, 101, 114, 32, 102, 97, 105, 108, 101, 100, 32, 119, 105, 116, 104, 32, 114, 101, 97, 115, 111, 110, 58, '\n', ...]
17:04:01.419 [error] ** State machine #PID<0.291.0> terminating
** Last event = {:internal,
{:ssh_msg_userauth_failure, 'publickey,password,keyboard-interactive', false}}
** When server state = [data: [{'State',
[starter: #PID<0.288.0>, auth_user: 'o5108005855.intern',
connection_state: {:connection, [], 127015, [], 0, :undefined, :undefined,
:undefined,
[user_pid: #PID<0.288.0>, host: '50.31.233.142',
user: 'o5108005855.intern', silently_accept_hosts: true], :undefined,
:undefined, :undefined, :undefined}, latest_channel_id: 0,
idle_timer_ref: :infinity, idle_timer_value: :infinity,
transport_protocol: :tcp, transport_cb: :gen_tcp,
transport_close_tag: :tcp_closed,
ssh_params: [role: :client,
peer: {'50.31.233.142', {{50, 31, 233, 142}, 22}}, c_vsn: {2, 0},
s_vsn: {2, 0}, c_version: 'SSH-2.0-Erlang/4.3',
s_version: 'SSH-2.0-OpenSSH_7.2', algorithms: :undefined,
kex: :"ecdh-sha2-nistp256", hkey: :"ecdsa-sha2-nistp256",
key_cb: :ssh_file, io_cb: :ssh_io, send_mac: :"hmac-sha2-256",
recv_mac: :"hmac-sha2-256", encrypt: :"aes256-ctr", encrypt_block_size: 16,
decrypt: :"aes256-ctr", decrypt_block_size: 16, compress: :none,
decompress: :none, c_lng: :none, s_lng: :none, user_ack: true,
timeout: :infinity,
opts: [user_pid: #PID<0.288.0>, host: '50.31.233.142',
user: 'o5108005855.intern', silently_accept_hosts: true],
send_sequence: 5, recv_sequence: 5, random_length_padding: 255,
user: 'o5108005855.intern', service: 'ssh-connection',
userauth_quiet_mode: false, userauth_methods: :none,
userauth_supported_methods: 'publickey,keyboard-interactive,password',
kb_tries_left: 0,
userauth_preference: [{'publickey', :ssh_auth, :publickey_msg,
[:"ssh-rsa"]}, {'publickey', :ssh_auth, :publickey_msg, ...},
{'publickey', :ssh_auth, ...}, {'publickey', ...}, {...}, ...],
pwdfun_user_state: :undefined, authenticated: false],
socket: #Port<0.5547>, undecrypted_packet_length: :undefined,
last_size_rekey: 0, event_queue: []]}]]
** Reason for termination = :error::badarg
** Callback mode = :handle_event_function
** Queued = [internal: :prepare_next_packet]
** Stacktrace =
** [{:unicode, :characters_to_binary, ["$gen_cast": :data_size], []},
{:ssh_auth, :password_msg, 1, [file: 'ssh_auth.erl', line: 89]},
{:ssh_auth, :userauth_request_msg, 1, [file: 'ssh_auth.erl', line: 158]},
{:ssh_connection_handler, :handle_event, 4,
[file: 'ssh_connection_handler.erl', line: 772]},
{:gen_statem, :loop_event, 9, [file: 'gen_statem.erl', line: 880]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]
Related
I am currently trying to INSERT INTO my SQL database a row of 144 columns.
The problem is that the last 10 values of the new row are NULL while they are supposed to be float and int.
That's an example of what I have in my DB after the INSERT INTO :
First column
Before last column
Last column
1
NULL
NULL
That's the SQL request I am using
INSERT INTO "historic_data2"
VALUES (28438, 163, 156, 1, 'FIST 2', 91, 81, 82, 84, 90, 6, '2 Pts Int M', 'Offensive', 0, '91_81_82_84_90', 86, 85, 0, 36, 62, 24, 0, 132, 86, 0, 83, 0, 0, 0, 0, 42, 77, 24, 0, 173, 107, 0, 204, 0, 0, 0, 0, 42, 77, 24, 0, 173, 107, 0, 204, 0, 0, 0, 81, 62, 34, 23, 19, 45, 32, 18, 9, 19, 0.5555555555555556, 0.5161290322580645, 0.5294117647058824, 0.391304347826087, 1.0, 82, 54, 34, 18, 28, 49, 27, 17, 8, 28, 0.5975609756097561, 0.5, 0.5, 0.4444444444444444, 1.0, 302, 233, 132, 89, 69, 168, 116, 69, 35, 69, 0.5562913907284768, 0.4978540772532189, 0.5227272727272727, 0.39325842696629215, 1.0, 214, 161, 84, 73, 53, 119, 79, 39, 36, 53, 0.5560747663551402, 0.4906832298136646, 0.4642857142857143, 0.4931506849315068, 1.0, 717, 544, 298, 233, 173, 416, 285, 175, 97, 173, 0.5801952580195258, 0.5238970588235294, 0.587248322147651, 0.41630901287553645, 1.0, 466, 315, 183, 128, 151, 357, 233, 138, 91, 151, 0.7660944206008584, 0.7396825396825397, 0.7540983606557377, 0.7109375,1.0,112)
I can't figure out how to solve this issue. My guess would be that there is a hard limit on how much column you can insert at once but I don't know how to solve that.
Thank you in advance for your help
My rabbitmq was working fine. Suddenly, one of the vhosts is not starting up. On restarting rabbitmq server, it shows in admin UI, that error is starting up vhost, and all the queues are in down state. Here is the error when I restart the vhost. Please suggest. Our production message broker is down, need immediate help.
Rabbitmq ver. - 3.8.3
Erlang ver. - 22.3
Trying to restart vhost 'r_t' on node 'rabbit#myserver' ...
Error:
Failed to start vhost 'r_t' on node 'rabbit#myserver'Reason: {:shutdown, {:failed_to_start_child,
:rabbit_vhost_process, {:error, {{{:badarg, [{:erlang, :binary_to_term, [<<131, 104, 6, 100, 0, 13, 98,
97, 115, 105, 99, 95, 109, 101, 115, 115, 97, 103, 101, 104, 4, 100, 0, 8, 114, 101, 115, 111, 117, 114,
99, 101, 109, 0, ...>>], []}, {:rabbit_queue_index, :parse_pub_record_body, 2, [file:
'src/rabbit_queue_index.erl', line: 783]}, {:rabbit_queue_index, :"-segment_entries_foldr/3-fun-0-", 4,
[file: 'src/rabbit_queue_index.erl', line: 1111]}, {:array, :sparse_foldr_3, 6, [file: 'array.erl', line:
1847]}, {:array, :sparse_foldr_2, 8, [file: 'array.erl', line: 1836]}, {:rabbit_queue_index,
:scan_queue_segments, 3, [file: 'src/rabbit_queue_index.erl', line: 741]}, {:rabbit_queue_index,
:queue_index_walker_reader, 2, [file: 'src/rabbit_queue_index.erl', line: 728]}, {:rabbit_queue_index,
:"-queue_index_walker/1-fun-1-", 2, [file: 'src/rabbit_queue_index.erl', line: 710]}]}, {:gen_server2,
:call, [#PID<10691.1882.0>, :out, :infinity]}}, {:child, :undefined, :msg_store_persistent,
{:rabbit_msg_store, :start_link, [:msg_store_persistent,
'/var/lib/rabbitmq/mnesia/rabbit#1myserver/msg_stores/vhosts/1SLGRHB3T7STV1U1TEB4MR6QS', [],
{#Function<2.23124100/1 in :rabbit_queue_index>, {:start, [{:resource, "r_t", :queue,
"product.import_royn_se"}, {:resource, "r_t", :queue, "customer.import_ronin_es"}, {:resource, "r_t",
...}, {:resource, ...}, {...}, ...]}}]}, :transient, 30000, :worker, [:rabbit_msg_store]}}}}}
I got a workaround.
We just exported and saved vhost definitions for existing vhost which was not starting. The deleted this vhost. Created same vhost and imported the definition back. So, we got all queues with same features.
-> For dump all messages
from os import listdir
from os.path import isfile, join
import re
base_path = '/docker/rabbitmq-nfe/data/mnesia/rabbit#rabbitmq_nfe/msg_stores/vhosts/628WB79CIFDYO9LJI6DKMI09L/queues'
list_queues = listdir(base_path)
#GET ALL QUEUES
for queue in list_queues:
dir_queue = '%s/%s' % (base_path, queue)
list_files = [f for f in listdir(dir_queue) if isfile(join(dir_queue, f)) and f not in ['.queue_name', 'journal.jif']]
list_files.sort()
name_queue = open('%s/.queue_name' % (dir_queue), 'r').read().split('QUEUE: ')[-1][:-1]
payload_queue = []
#GET ALL FILES QUEUES
for file in list_files:
path_file = '%s/%s' % (dir_queue, file)
binary_file = open(path_file, 'r')
string_file = binary_file.read()
string_file_decoded = string_file.decode('iso 8859-1')
#GET ALL PAYLOAD FILES QUEUES
list_payload_queue = ['{%s}' % f for f in re.split('\{(.*?)\}', string_file_decoded) if 'chave' in f and 'rede' in f]
for idx, payload in enumerate(list_payload_queue):
if payload.count('{') > 1:
list_payload_queue[idx] = ['{%s' % f for f in payload.split('{') if 'chave' in f and 'rede' in f][0]
payload_queue = payload_queue + list_payload_queue
#SAVE BACKUP QUEUES
print('FILA: %s ARQUIVOS: %s' % (name_queue, str(len(payload_queue))))
with open('/tmp/%s.log' % name_queue, 'w') as f:
for line in payload_queue:
f.write("%s\n" % line)
I am using RabbitMQ version 3.7.17
As my AWS hard disk was completely occupied(100% full). Due to which all the services stopped working
Solution to this: I extended AWS server memory and than tried to start all the API services after that it started throwing error. (Post this it started giving error)
Connection.open: (541) INTERNAL_ERROR - access to vhost '/' refused for user 'XYZ': vhost '/' is down
Restarted RabbitmMQ server using the below code still it was giving error:
sudo service rabbitmq-server restart
If I checked the permission for my user using:
sudo rabbitmqctl list_permissions --vhost /
Response shows that user has all the access.
Listing permissions for vhost "/" ...
user configure write read
XYZ .* .* .*
Thank You.
As the Memory was full the RabbitMQ that was processing was not completed which resulted it in error in vhost.
When tried to restart vhost sudo rabbitmqctl restart_vhost it got error:
ERROR:
Failed to start vhost '/' on node 'rabbit#ip-172-31-16-172'Reason: {:shutdown, {:failed_to_start_child, :rabbit_vhost_process, {:error, {{{:function_clause, [{:rabbit_queue_index, :journal_minus_segment1, [{{true, <<230, 140, 82, 5, 193, 81, 136, 75, 11, 91, 31, 232, 119, 30, 99, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 144>>, <<131, 104, 6, 100, 0, 13, 98, 97, 115, 105, 99, 95, 109, 101, 115, 115, 97, 103, 101, 104, 4, 100, 0, 8, 114, 101, 115, 111, 117, 114, ...>>}, :no_del, :no_ack}, {{true, <<230, 140, 82, 5, 193, 81, 136, 75, 11, 91, 31, 232, 119, 30, 99, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 144>>, <<131, 104, 6, 100, 0, 13, 98, 97, 115, 105, 99, 95, 109, 101, 115, 115, 97, 103, 101, 104, 4, 100, 0, 8, 114, 101, 115, 111, 117, ...>>}, :del, :no_ack}], [file: 'src/rabbit_queue_index.erl', line: 1231]}, {:rabbit_queue_index, :"-journal_minus_segment/3-fun-0-", 4, [file: 'src/rabbit_queue_index.erl', line: 1208]}, {:array, :sparse_foldl_3, 7, [file: 'array.erl', line: 1684]}, {:array, :sparse_foldl_2, 9, [file: 'array.erl', line: 1678]}, {:rabbit_queue_index, :"-recover_journal/1-fun-0-", 1, [file: 'src/rabbit_queue_index.erl', line: 915]}, {:lists, :map, 2, [file: 'lists.erl', line: 1239]}, {:rabbit_queue_index, :segment_map, 2, [file: 'src/rabbit_queue_index.erl', line: 1039]}, {:rabbit_queue_index, :recover_journal, 1, [file: 'src/rabbit_queue_index.erl', line: 906]}]}, {:gen_server2, :call, [#PID<10397.473.0>, :out, :infinity]}}, {:child, :undefined, :msg_store_persistent, {:rabbit_msg_store, :start_link, [:msg_store_persistent, '/var/lib/rabbitmq/mnesia/rabbit#ip-172-31-16-172/msg_stores/vhosts/628WB79CIFDYO9LJI6DKMI09L', [], {#Function<2.32138423/1 in :rabbit_queue_index>, {:start, [{:resource, "/", :queue, "xx_queue"}, {:resource, "/", :queue, "app_xxx_queue"}, {:resource, "/", :queue, "default"}, {:resource, "/", :queue, "xx_priority_queue"}, {:resource, "/", :queue, "xxx_queue"}, {:resource, "/", :queue, "xxxx_queue"}, {:resource, "/", :queue, "yyy_queue"}, {:resource, "/", :queue, "zzz_queue"}, {:resource, "/", :queue, "aaa_queue"}]}}]}, :transient, 30000, :worker, [:rabbit_msg_store]}}}}}
STEPS TO SOLVE IT
Stop your app node by below command.
sudo rabbitmqctl stop_app
Reset your node by below command.
Removes the node from any cluster it belongs to, removes all data from the management database, such as configured users and vhosts, and deletes all persistent messages.(Be careful while using it.)
To backup your data before reset look here
sudo rabbitmqctl reset
Start your Node by below command.
sudo rabbitmqctl start_app
Restart your vhost by below commad.
sudo rabbitmqctl restart_vhost
And if you are using some application that is depended on RabbitMQ. Such as I using celery you will have to restart them again.
This was the link that helped me to solve it.
I want my animation to only play once and not loop. My understanding is that you can do that by setting "next" to false. However, my animation is still looping. Here is my sprite sheet json file:
{
"images": [
"ressources/atlas/apparition.png"
],
"framerate": 12,
"frames": [
[1, 1, 170, 172, 0, -15, -15],
[1, 175, 164, 165, 0, -19, -18],
[1, 342, 156, 160, 0, -23, -21],
[159, 342, 147, 146, 0, -27, -28],
[167, 175, 134, 128, 0, -33, -37],
[173, 1, 122, 96, 0, -40, -52],
[173, 99, 96, 64, 0, -52, -68]
],
"animations": {
"apparition": { "frames": [6, 5, 4, 3, 2, 1, 0], "next": false }
}
}
Ideas?
Well... it seems that you must use gotoAndPlay() if you want to prevent looping. I was using play().
I am trying to write Swift implementation of the following ObjC(header file) code.
#include <stddef.h>
#ifndef VO_CERTIFICATE_TYPE
#define VO_CERTIFICATE_TYPE
typedef struct _voCertificate
{
const char* bytes;
size_t length;
}
voCertificate;
#endif
static const char myCertificate_BYTES[] =
{
103, 92, -99, 33, 72, 48, 119, -72,
-77, 75, -88, 81, 113, -46, -119, -119,
5, 42, -33, 94, 23, 3, -112, 34,
-63, 75, -77, 26, -41, -69, 50, 71,
19, 121, 109, -60, 40, 18, 46, -86,
..........
};
voCertificate const myCertificate =
{
myCertificate_BYTES,
sizeof(myCertificate_BYTES)
};
//////////////////////////////////////
NSData *certificate = [NSData dataWithBytes:myCertificate.bytes length:myCertificate.length];
My best assumption was:
let myCertificate = [
103, 92, -99, 33, 72, 48, 119, -72,
-77, 75, -88, 81, 113, -46, -119, -119,
5, 42, -33, 94, 23, 3, -112, 34,
-63, 75, -77, 26, -41, -69, 50, 71,
19, 121, 109, -60, 40, 18, 46, -86,
........................]
var certificate = NSData(bytes: myCertificate as [Byte], length: myCertificate.count)
I tried to reach ObjC variable through Bridging-Header too, but there was "Undefined symbols for architecture armv7" error.
I would really appreciate any help.
Your biggest problem is that the type of your myCertificate array is Int not Int8. Here is something that is working for me. Note I reconstructed the array from the NSData object to see if everything came out ok.
let myCertificate = Array<Int8>(arrayLiteral:
103, 92, -99, 33, 72, 48, 119, -72,
-77, 75, -88, 81, 113, -46, -119, -119,
5, 42, -33, 94, 23, 3, -112, 34,
-63, 75, -77, 26, -41, -69, 50, 71,
19, 121, 109, -60, 40, 18, 46, -86)
var certificate = NSData(bytes: myCertificate, length: myCertificate.count)
var buffer = [Int8](count: certificate.length, repeatedValue: 0)
certificate.getBytes(&buffer, length: certificate.length)