struggling with NMSSH in swift; errors -2, -9, -18, - swift

I am trying to implement something using the NMSSH framework in swift.
To not have my UI freeze while collecting data from the servers I put everything inside a
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0))
And I sometimes (about 50% probability) randomly get one of these errors. I am not sure what causes them or how to prevent them. The appear seemingly randomly, but in chains, one it goes wrong it will keep going wrong for a while, and when it finally works it will work a few times in a row.
Socket connection to 192.168.178.27 on port 22 failed with reason -2, trying next address...
Error Domain=libssh2 Code=-18 "Authentication failed (keyboard-interactive)" UserInfo={NSLocalizedDescription=Authentication failed (keyboard-interactive)}
Error Domain=libssh2 Code=-9 "Waiting for password response" UserInfo={NSLocalizedDescription=Waiting for password response}
but most frequently
Error Domain=libssh2 Code=-9 "Would block requesting userauth list" UserInfo={NSLocalizedDescription=Would block requesting userauth list}
and
Error Domain=libssh2 Code=-9 "Would block" UserInfo={NSLocalizedDescription=Would block}
EDIT: I pasted my whole code here, but it is kinda messy.
The function is supposed to be called once and then check a bunch of servers for their availability.
getServers() returns an array of dictionaries, each looking like ["alias": "iMac", "ip":" mac.local", "port":"22", "username": "root", "password": "123"]

Try using NSOperationQueue, it is higher level and might be able to handle that better

Related

R2DBC MSSQL r2dbc.mssql.client.ReactorNettyClient : Connection has been closed by peer

I have started to work on a Spring WebFlux and R2DBC project. Mainly, my code works fine.
But after some elements I am receiving this warning
r2dbc.mssql.client.ReactorNettyClient : Connection has been closed by peer
after this warning I am getting this exception and normally program stops to read from Flux which source is R2DBC driver.
ReactorNettyClient$MssqlConnectionClosedException: Connection unexpectedly closed
My main pipeline like this;
Sinks.Empty<Void> completionSink = Sinks.empty();
Flux<Event> events = service.getPairs(
taskProperties.A,
taskProperties.B);
events
.flatMap(some operation)
.doOnComplete(() -> {
log.info("Finished Job");
completionSink.emitEmpty(Sinks.EmitFailureHandler.FAIL_FAST);
})
.subscribe();
completionSink.asMono().block();
After run, flatMap requesting 256 element as a default, then after fetching trying to request(1) for next signal.
At somewhere between 280. and 320. element it is getting above error. It is not idempotent, sometimes it reads 280 element sometimes it is reading 303, 315 etc.
I think it is about network maybe? But not sure and cannot find the reason. Do I need a pool or something different?
Sorry if I missed anything, in case you want I will try to update here.
Thank you in advance
I have tried to change request size of flatMap to unbounded, adding scheduler, default r2dbc pool but for now I don't have any clue.

[ script:es_extended SCRIPT ERROR: #es_extended/server/functions.lua:127: attempt to index a nil value (local 'xPlayer')

[ script:es_extended] SCRIPT ERROR: #es_extended/server/functions.lua:127: attempt to index a nil value (local 'xPlayer')
[ script:es_extended] > ref (#es_extended/server/functions.lua:127)
Please help me im triggered af Thats my Fivem Console (TxAdmin) Nothing works Esx is completly broke after a server Restart
I had a look at the source code. My best guess is that the player you are using isn't registered in the MySQL database for some reason.
I am guessing this because of the following:
The immediate cause of the error is that xPlayer is nil in server/functions.lua:127
This is due to the player object not being added to the ESX.Players table in server/main.lua:239
The info necessary to make the player object is taken from MySQL on server/main.lua:115
So the most obvious explanation would be that the user wasn't found in the database. It is also possible that the program could not connect to the database at all, but it looks like the fivem-mysql-async library would raise an error instead of continuing silently, so that is less likely (although this would need testing to discount completely).
Are there any messages in the server logs that might give you a clue as to what's going on?

SocketError handling in Prolog

I'm a bit unfamiliar with the mechanics of error recovery in prolog, so I apologize in advance if the question seems stupid.
I am looking for a way to properly handle SocketError in swi-prolog. So far I have only found the following snippet:
setup_call_catcher_cleanup(tcp_socket(Socket),
tcp_connect(Socket, Host:Port),
exception(_),
tcp_close_socket(Socket)).
Whenever a connection is refused, it raises the appropriate exception and performs the cleanup action, closing the socket.
Problem is, i want to embed this in a predicate test_socket/3 that sets a status code whenever a connection gets refused and I cannot seem to find a way to do so. I tried doing:
test_socket(Host, Port, Status) :-
setup_call_catcher_cleanup(tcp_socket(Socket),
tcp_connect(Socket, Host:Port),
exception(_),
(tcp_close_socket(Socket), Status = 1).
but this doesn't seem to do the trick. Any ideas?
The purpose of the argument Cleanup is to perform some cleanup action, and then to continue, as if this cleanup has not happened. That is, the exception goes further up and Status = 1 is superfluous. The construct is not made to do everything. But probably a catch/3 above all of this, is what you want.
– false

Siemens S7-1200. TRCV_С. Error code: 893A; Event ID 02:253A

Please, help to solve the problem with communication establishment between PC and 1211C (6ES7-211-1BD30-0XB0 Firmware: V 2.0.2). I feel that I've made a stupid mistake somewhere, but can't figure out where exactly it is.
So, I'm using function TRCV_С...
The configuration seems to be okay:
When i set the CONT=1, the connection establishes without any problems...
But, when i set EN_R=1, I'm getting "error 893A".
That's what I have in my diagnostic buffer: (DB9 - is a block where the received data is supposed to be written)
There is an explanation given for "893A" in the manuals: Parameter contains the number of a DB that is not loaded. In diag. buffer its also written that DB9 is not loaded. But in my case it is loaded! So what should I do in this case?
it seems that DB were created or edited manually due to which they are miss aligned with FB instances try removing and DB and FB instances and then add again instances of FBs with automatically created DBs and do a offline dowonload

In Pure Data is there any way to track down a "signal outlet connect to nonsignal inlet (ignored)" error?

I have a Pd patch which calls in a second patch as an abstraction.
The second patch works fine by itself. But when I try to use it from inside the first, I'm seeing this
signal outlet connect to nonsignal inlet (ignored)
error. But I can't see WHERE it's happening.
Doing "Find last error" just gives me.
... sorry, I couldn't find the source of that error.
How can I find out which two objects Pd is referring to with that outlet / inlet?
(The outlets of the subpatches are being wired into [dac~] in the main patch)
These subpatches USED TO work, until I tried to add Open Sound Control to them with udpreceive. And, like I say, they still do work, accepting the OSC if I run them on their own.
actually, Pd (>=0.43) became quite good at locating the source of errors, but unfortunately this is little known (and less documented).
if you get a findable error (usually those in red; and the error you get is one of them!), you can click on the error-line and it will take you to the object that complained (and select it)
the actual click-sequence is OS-dependent:
linux: Ctrl+LeftMouseButton
w32 : Ctrl+LeftMouseButton
OSX : ⌘+LeftMouseButton
alternatively you can get to the error, by clicking on the error-message and then hitting
Return
(Enter should work as well).