What does: IOError in socket::open = -137 mean? | Telit Cinterion IoT Developer Community
October 2, 2018 - 6:53pm, 4294 views
Hi,
we face from time to time the problem that we get the error mentioned in the title when we try to open a socket connection to our server. In most of the cases it works perfect, but sometimes we get this error, and the really big problem is, that when this happens once it does not disappear till we reboot the module. After reboot it works again as expected.
Can anyone tell us what the error means, and if there is, maybe a workaround available without a reboot?
Thanks in advance,
Best Regards,
Andy
Hello,
The message for -137 error is 'No buffer space available'. So there may be a problem with resources used by socket connections.
The most probable cause I can think of would be that socket connections might not be closed properly (I mean closing the socket and streams each time) or the connections might be established and closed very frequently without leaving time for JVM to cleanup or the application might try to open too many connections at the same time.
What is the typical scenario with sockets - how many connections are being open and how frequently?
Please add the information about the module (ATI1 reply).
Best regards,
Bartłomiej
Hi,
oh perfect that's enlightening, of course all the following retries are in vain.
It happens only on devices with a poor connection to the GPRS Network, let's say with low signal quality.
What is the recommended way to close proberly when the following call throws a timeout exception when trying to connect:
_sc = (SocketConnection) Connector.open(openParam, Connector.READ_WRITE, true);
Would it be:
if (_sc != null) _fc.close(); ?
ati1
Cinterion
EHS8
REVISION 03.001
A-REVISION 00.000.51
Best Regards,
Andy
Hello,
I think that the most important would be to put Connector.open() and the following code into try{} catch(){} block and put the closing logic into finally{} block. Then it will be executed even in case of an exception. Your condition is fine. Inside that finally block you should first close the streams in a same way putting each closing method into a separate try catch block if it throws exceptions to make sure that all closing logic will be attempted to be executed.
The firmware version is not old but there is an update to A-REVISION 00.000.55 available.
Best regards,
Bartłomiej
Hi,
yes, it looks like that was the problem.
Thanks allot.
BTW.: Is there anywhere in the documentation the explantation of the return values? I didn't found it but maybe i've overlooked it.
The message for -137 error is 'No buffer space available
I have also somtimes the values -121 and -123
Best Regards,
Andy
Hello,
These values are currently not described in API. I need to verify if I can publish the whole list.
In a meantime here's what I've found for -121 and -123:
-121 Software caused connection abort.
-123 Connection reset by peer.
However I think that the error code and description not always can let us be sure what has really happened, especially if it happens sporadically.
Best regards,
Bartłomiej
Hello
Please ,What does: IOError in socket::open = 0 mean?
Hello,
Could you pleasse write a bit more - what module you are using (ATI1 reply) and what is the scenario which gives this error?
Thanks,
Bartłomiej