JavaMail IdleManager throws "Folder is not using SocketChannels" exception after a while - scala

I'm using IdleManager, in Scala, to listen to a Gmail folder.
I already have this props.setProperty("mail.imaps.usesocketchannels", "true")
The main part of my code is like this:
folder.addMessageCountListener(new MessageCountAdapter() {
override def messagesAdded(ev: MessageCountEvent) {
Logger.info("Got " + ev.getMessages.length + " new messages")
idleManager.watch(folder)
}
})
// timeLength = 20 minutes
system.scheduler.schedule(initialDelay = timeLength, interval = timeLength) {
try {
folder.asInstanceOf[IMAPFolder].doCommand(new IMAPFolder.ProtocolCommand() {
def doCommand(p: IMAPProtocol) = {
p.simpleCommand("NOOP", null)
null
}
})
Logger.debug("Continue after sending NOOP")
idleManager.watch(folder)
} catch {
case e: Exception => Logger.error(s"MailHelper: ${e.getMessage}")
}
}
idleManager.watch(folder)
You can see that I let the idleManager continue watching the folder after I get new messages and after I send a NOOP command. A scheduler is created to periodically (currently, once in 20 minutes) send a NOOP command to the server, to keep the connection. My program worked fine, but just for a while.
14 hours after the first call idleManager.watch(folder) and about 12.5 hours after the last email received, I still got the log Continue after sending NOOP, but right after that is an error log MailHelper: Folder is not using SocketChannels.
Could you please help me with this?
Edited:
Thanks #BillShannon for your quick reply. I have updated from v1.5.2 to v1.5.6 and turned on the debug output. I'm sure the Properties object and the "store" instance (created from a Session with the "imaps" protocol) are unchanged.
The error has appeared again. After a call to idleManager.watch(folder), here is the log ([folder] is the imaps protocol string for my folder)
DEBUG IMAP: IdleManager watching [folder]
A385 IDLE
+ idling
DEBUG IMAP: startIdle: set to IDLE
DEBUG IMAP: startIdle: return true
DEBUG IMAP: IdleManager.watch startIdle succeeded for [folder]
DEBUG IMAP: IdleManager selected 0 channels
DEBUG IMAP: IdleManager adding [folder] to selector
DEBUG IMAP: IdleManager waiting...
DEBUG IMAP: IdleManager selected 1 channels
DEBUG IMAP: IdleManager selected folder: [folder]
DEBUG IMAP: handleIdle: set to RUNNING
DEBUG IMAP: IdleManager got exception for folder: [folder], THROW:
javax.mail.FolderClosedException: * BYE JavaMail Exception: java.io.IOException: Connection dropped by server?
at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3199)
at com.sun.mail.imap.IdleManager.processKeys(IdleManager.java:370)
at com.sun.mail.imap.IdleManager.select(IdleManager.java:281)
at com.sun.mail.imap.IdleManager.access$200(IdleManager.java:137)
at com.sun.mail.imap.IdleManager$1.run(IdleManager.java:164)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
DEBUG IMAP: IdleManager waiting...
20 minutes later, the program sent another "NOOP", the status returned was "OK". And the program called idleManager.watch(folder) once again, here the error log reappeared Folder is not using SocketChannels.
Do you need anything else? Is this an issue with the library?

Related

Extension Quokka for vscode 1.67.2 don't start on macOS 12.4

when i start quokka on a js file i have this error message on the output window:
try{this._fileExistsSync(a)&&(l=JSON.parse(this._readFileSync(a)))}catch(o){}l.projects||(l.projects={});var c=s(this._localRoot);e.projectRoot=this.localRoot;var u=l.projects[c]||{};delete l.projects[c],l.projects[c]=u;var h=e.fileId||s(e.path),d=!u[h];for(delete u[h],u[h]=e,d&&(l.total=(l.total||0)+1);l.total>t;)for(var p in l.projects){var f=l.projects[p];if(!.isEmpty(f)){for(var g in f){var v=f[g];if(delete f[g],l.total--,v.scratchFile&&!v.content)try{this._unlinkFileSync(n(v.fileId))}catch(o){}break}break}delete l[p]}try{this._writeFileSync(a,JSON.stringify(l))}catch(o){}}}),module.exports=Project},{"./babelCompiler":8,"./chromeProfileViewer":11,"./config":14,"./extension/shared/utils":39,"./instrumentor":42,"./processor":59,"./testTask":63,"./tracking":65,"./typeScriptPostprocessor":67,"./typeScriptUtils":68,"./utils":70,child_process:void 0,"lru-cache":void 0,os:void 0,path:void 0,semver:void 0,typescript:void 0,url:void 0,util:void 0}],61:[function(e,t,i){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},r.apply(this,arguments)},n=this&&this.__awaiter||function(e,t,i,r){function n(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(t){s(t)}}function a(e){try{l(r"throw")}catch(t){s(t)}}function l(e){e.done?i(e.value):n(e.value).then(o,a)}l((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){function i(e){return function(t){return r([e,t])}}function r(i){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,s&&(o=2&i[0]?s["return"]:i[0]?s["throw"]||((o=s["return"])&&o.call(s),0):s.next)&&!(o=o.call(s,i[1])).done)return o;switch(s=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,s=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(o=l.trys,!(o=o.length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(r){i=[6,r],s=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}var n,s,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(a){n={error:a}}finally{try{r&&!r.done&&(i=s["return"])&&i.call(s)}finally{if(n)throw n.error}}return o},a=e("os"),l=e("path"),c=e("http"),u=e("./utils"),h=logger.create("workers").debug,d=e("ws").Server,p=/^win/.test(process.platform),f="&wallabyFileId=",g="Wallaby.js cache is corrupted, please restart wallaby.js",v="Jest cache is corrupted, please clear jest cache (npx jest --clearCache) and then restart wallaby.js",y=/.jasmine.js:(\d|\s)throw error;[^^]^\s/s,m=function(e,t){var i=this;i._project=e,i._opts=e.settings(),i._extension=t,i._mapConsoleMessagesStackTrace=i.project.settings().mapConsoleMessagesStackTrace,process.env.quokka&&(i.reportConsoleOutput=function(t){var i=.extend({},t);e.resolveLogEntryRange(i),e._emitInternal({type:"consoleOutput",data:i})},i.reportIntermediateResult=function(e){}),i._sessions={},i._executedTestNumber=0,i._testRunId=0,i._workers={},i._testFilesByWorker={},i._workerPingTimeoutOverride={},i._connectingWorkers={},i._workerPendingCleanup={},i._calculateNumberOfParallelWorkers(),i._hasGlobalSetupOrTeardown=this._project.hasGlobalSetupOrTeardown();for(var r=Math.max(i._maxWorkers,i._minWorkers)+(i._hasGlobalSetupOrTeardown?1:0),n=0;n<r;n++)i.getWorker(n);i._globalWorkerId=r,i._normalizedWallabyServerPath=this._project.normalizePath(l.dirname(process.mainModule.filename)),i._normalizedLocalRoot=this._project.normalizePath(this._project._localRoot),i._zeroConfigJest=this._project.isZeroConfigJest(),i._nodeJasmine=this._project.isNodeJasmine(),i._unresponsiveStandardTimeout=Math.max(500,i._opts.unresponsiveStandardTimeout||(i._zeroConfigJest?2e3:200)),i._unresponsiveInitialTimeout=Math.max(i._unresponsiveStandardTimeout,i._opts.unresponsiveInitialTimeout||(i._zeroConfigJest?7e3:200)),i._longExecutingWarningTimeout=Math.max(500,i._opts.longExecutingWarningTimeout||5e3),i._longExecutingPingTimeout=Math.max(200,i._opts.longExecutingPingTimeout||200),i._globalSetupTeardownTimeout=Math.max(10,i._opts.globalSetupTeardownTimeout||5e3)};m.prototype={"worker:transformedFile":function(e){this._project.testRunnerTransformedFile(e)},"worker:profile":function(e){this._resolveProfileRunPromise&&(this._resolveProfileRunPromise(e),delete this._resolveProfileRunPromise)},start:function(e){var t=this,i=t._httpServer=e?c.createServer(e):c.createServer();return i.listen(0),Q.promise(function(e,r){i.on("listening",function(){try{t._receiverPort=i.address().port,h("Web server is listening at "+t._receiverPort),t._wss=new d({server:i,verifyClient:function(e){return _.verifyLocalOrigin(e.origin)}}),t._wss.on("connection",function(e){e.on("message",function(i){var r;try{r=JSON.parse(i)}catch(n){return void console.error("Failed to deserialize message from worker: "+i+", "+(n&&n.message))}if(t["worker:"+r.type])return t"worker:"+r.type;if(r.worker){var s=t._workers[r.worker];if(!s)return;if(s.onConnected)s.onConnected(e);else if(process.env.quokka&&s.instance){if(s.instance.channel)try{s.instance.channel.close(),s.instance.channel.removeAllListeners()}catch(n){}s.instance.channel=e}try{e.send(JSON.stringify({type:"in:connected"}))}catch(n){console.error('Failed to send the "connected" message to worker. '+n.message)}}else if(r.session){var o=t._sessions[r.session],a=!o||(o._disposing||t.cancelled(o._testRunId))&&!o._globalSetup;if("console"===r.type&&r.data){if("debugLog"===r.data.type)return void h(r.data.text);(r.data.spec||process.env.quokka)&&!a||"autoLog"===r.data.type||console.log("console."+r.data.type+": "+r.data.text)}if(a)return;try{or.type}catch(n){console.error("Failed to process message "+r.type+" from worker, "+(n&&n.message)),o.reject(n)}}})}),e()}catch(n){r(n)}})})},wallabyFileIdPrefix:function(){return f},traceContext:function(){return this._traceContext},receiverPort:function(){return this._receiverPort},setFileRoot:function(e){this._fileRoot=this._project.normalizePath(e)},run:function(e){return n(this,void 0,void 0,function(){var t,i,n,o,a,l,c,u,d,p,f,g,v,y,m,b,k,T,S,C;return s(this,function(s){switch(s.label){case 0:if(t=this,t._cancelled=!1,t._testRunId++,t._executedTestNumber=0,t._runPriority=e.priority,t._traceContext=e.traceContext,t._profileRun=e.profileRun,i=0,t._profileRun?(t._profileRunPromise=Q.promise(function(e){t._resolveProfileRunPromise=e}),e.testFilesToLoad&&1===e.testFilesToLoad.length&&(i=t._findWorkerThatExecutedTestFile(e.testFilesToLoad[0])||0)):(delete this._resolveProfileRunPromise,delete this.profileRunPromise),e.recycleBeforeRun&&.each(t._workers,function(e,i){t.recycleWorker(i)}),h("Starting test run, priority: "+t._runPriority),t._startTime=(new Date).getTime(),n=e.fullRun&&t._maxWorkers>1&&e.testFilesToLoad.length>1?t._maxWorkers:t._minWorkers>1&&e.testFilesToLoad.length>1&&!(e.fullRun&&t._maxWorkers<t._minWorkers)?t._minWorkers:1,o=void 0,!t._hasGlobalSetupOrTeardown||!e.testFilesToLoad.length)return[3,4];a=setTimeout(function(){console.log("Some long running code has been detected: Global Setup")},t._longExecutingWarningTimeout),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,t.runGlobalSetup(e)];case 2:return o=s.sent(),clearTimeout(a),[3,4];case 3:if(l=s.sent(),clearTimeout(a),l.error)throw l.error;return[2,l.result];case 4:1===n&&.each(e.testFilesToLoad,function(e){ 

Where is the mirth connect transformer error stored?

Just wandering, will it be possible or the way that I can extract (or to find out) where is the com.mirth.connect.server.MirthJavascriptTransformerException stored ?
For example:
Within a channel, I write a script to call function abc (which this function is not exists). When I deployed and start the channel, I found mirth throw an exception error message and the error message can be found under the Mirth Connect Administrator Console:
Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransformerException:
CHANNEL: Send Test Messages
CONNECTOR: Destination 1
SCRIPT SOURCE: TRANSFORMER
SOURCE CODE:
352: msg = new XML(connectorMessage.getTransformedData());
353: if (msg.namespace('') != undefined) { default xml namespace = msg.namespace(''); } else { default xml namespace = ''; }
354: function doFilter() { phase[0] = 'filter'; return true; }function doTransform() { phase[0] = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase[0]);
355:
356:
357: abc();
358: if ('xml' === typeof msg) {
359: if (msg.hasSimpleContent()) {
360: msg = msg.toXMLString();
361: }
LINE NUMBER: 357
DETAILS: ReferenceError: "abc" is not defined.
at 118ddcea-ea82-4b20-9548-6b5d8df13244:357 (doTransform)
at 118ddcea-ea82-4b20-9548-6b5d8df13244:379 (doScript)
at 118ddcea-ea82-4b20-9548-6b5d8df13244:381
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.doCall(JavaScriptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.doCall(JavaScriptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScriptTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
My question is, beside of under Mirth Connect Administrator Console, will this error message been stored into any log file ? (I have checked mirth.log and found nothing there).
The folder path %installdir%\Mirth Connect\logs could have additional log files like mirth.log.1, mirth.log.2 etc in addition to the mirth.log, which is always the latest. Have you checked the serialized logs

Asterisk-Java Unable to load Properties file

I'm developing a very simple Asterisk-Java IVR based program that greets the caller, retrieves some information from a web service, reads up the retrieved data to the caller, and finally hangs up.
What steps I followed:
Added the following line is entered on extensions_custom.conf:
exten => 1000,n,Agi(agi://192.168.0.8/ivryobi.agi)
Created the following file structure inside C:\Project\target\classes\
Runnable.java
IvrYobi.java
Runnable.class
IvrYobi.class
fastagi-mapping.properties
Inside fastagi-mapping.properties I have:
ivryobi.agi = main.IvrYobi
The contens of IvrYoby are:
public class IvrYobi extends BaseAgiScript {
public void service(AgiRequest request, AgiChannel channel) throws AgiException {
String callerMsisdn = request.getCallerIdNumber();
}
When it works normally
Running the following command in the console
C:\Project\target\classes>java -cp
asterisk-java.jar;commons-lang3-3.10.jar;commons-logging-1.2.jar;httpclient-4.5.12.jar;httpcore-4.4.13.jar;mysql-connector-java-8.0.20.jar;.
org.asteriskjava.fastagi.DefaultAgiServer
As you can see on the following console output, works perfectly
jun 30, 2020 6:09:04 PM org.asteriskjava.fastagi.DefaultAgiServer
startup INFORMACIËN: Listening on *:4573. jun 30, 2020 6:09:09 PM
org.asteriskjava.fastagi.AbstractAgiServer getPool INFORMACIËN: Thread
pool started. jun 30, 2020 6:09:09 PM
org.asteriskjava.fastagi.ResourceBundleMappingStrategy
loadResourceBundle INFORMACIËN: Added mapping for 'ivryobi.agi' to
class IvrYobi ...
When the problem appears
When I run the very same code, but insted of the console I use Runnable.java
Here are the contents of Runnable.java:
DefaultAgiServer server = new DefaultAgiServer();
public MyRunnable() {
ClassNameMappingStrategy strategy = new ClassNameMappingStrategy(false);
server.setMappingStrategy(strategy);
}
public void run() {
try {
server.startup();
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
server.shutdown();
}
}
public void stop() {
server.shutdown();
}
We can observe the following error on Eclipse's console:
0 [main] DEBUG org.asteriskjava.fastagi.DefaultAgiServer - Using
channelFactory
org.asteriskjava.fastagi.internal.DefaultAgiChannelFactory 9 [main]
INFO org.asteriskjava.fastagi.DefaultAgiServer - Listening on *:4573.
4806 [main] DEBUG org.asteriskjava.fastagi.DefaultAgiServer -
Received connection from /192.168.0.254 4810 [main] INFO
org.asteriskjava.fastagi.DefaultAgiServer - Thread pool started. 4849
[AJ DaemonPool-1.1] DEBUG
org.asteriskjava.fastagi.ClassNameMappingStrategy - Unable to create
AgiScript instance of type ivryobi.agi: Class not found, make sure the
class exists and is available on the CLASSPATH 4849 [AJ
DaemonPool-1.1] ERROR
org.asteriskjava.fastagi.internal.FastAgiConnectionHandler - No
script configured for URL 'agi://192.168.0.8/ivryobi.agi' (script
'ivryobi.agi')
Attempted troubleshooting
I already made sure that fastagi-mapping.properties is on the CLASSPATH.
Tried different name and case
Copied the .properties file on the java Execution Path
Compiled the project as an executable jar
Added / removed packages inside eclipse (ex: com.test.IvrYobi) and also applied the changes on the .properties file.
I checked the code inside asterisk-java-3.5.0.jar, looks like that in case that the configuration file is not found, it just continues without throwing any warning. Since is packed inside the jar I'm unable to modify that code.
Please, do you have any other ideas I can try?
Finally found the solution by myself
I had to recompile asterisk-java.jar using the project's source code
On DefaultAgiServer.java change the line:
resourceBundle = ResourceBundle.getBundle(configResourceBundleName);
With:
FileInputStream fis = new FileInputStream("myivr.properties");
resourceBundle = new PropertyResourceBundle(fis);
logger.info("resourceBundle cargado ok!");
On the catch, replace the
return;
with a more decent response, so you will know if the resource could not be loaded
logger.info("resourceBundle cargado ok!");
}
catch (MissingResourceException | IOException e)
{
logger.error("No existe el recurso invocado: " + e.getMessage());
return;
}

TCP data sometimes not received by java (or python) server

I'm developing a system that consists of an arduino mkr1000 that I want to send data via wifi to a java server program running in my local network.
Everything works except the main part: data sent by the arduino is sometimes not received by the server...
I'm using the arduino Wifi101 library to connect to my wifi, get a WiFiClient and send data.
The following code is just a example to demonstrate the problem:
for (int i = 0; i < 3; ++i) {
Serial.println(F("Connecting to wifi"));
const auto status = WiFi.begin("...", "...");
if (status != WL_CONNECTED) {
Serial.print(F("Could not connect to WiFi: "));
switch (status) {
case WL_CONNECT_FAILED:
Serial.println(F("WL_CONNECT_FAILED"));
break;
case WL_DISCONNECTED:
Serial.println(F("WL_DISCONNECTED"));
break;
default:
Serial.print(F("Code "));
Serial.println(status, DEC);
break;
}
} else {
Serial.println(F("WiFi status: WL_CONNECTED"));
WiFiClient client;
if (client.connect("192.168.0.102", 1234)) {
delay(500);
client.print(F("Test "));
client.println(i, DEC);
client.flush();
Serial.println(F("Data written"));
delay(5000);
client.stop();
} else {
Serial.println(F("Could not connect"));
}
WiFi.end();
}
delay(2000);
}
The java server is based on Netty but the same thing with manually creating and reading from a Socket yields the same result.
The testing code is pretty standard with only a simple output (note: in Kotlin):
val bossGroup = NioEventLoopGroup(1)
val workerGroup = NioEventLoopGroup(6)
val serverFuture = ServerBootstrap().run {
group(bossGroup, workerGroup)
channel(NioServerSocketChannel::class.java)
childHandler(object : ChannelInitializer<NioSocketChannel>() {
override fun initChannel(ch: NioSocketChannel) {
ch.pipeline()
.addLast(LineBasedFrameDecoder(Int.MAX_VALUE))
.addLast(StringDecoder())
.addLast(object : ChannelInboundHandlerAdapter() {
override fun channelRead(ctx: ChannelHandlerContext, msg: Any) {
println("msg = $msg")
ctx.close()
}
})
}
})
bind(port).sync()
}
The arduino tells that everything is OK (i.e. writing Data written to the serial console for each iteration) but the server sometimes skips individual messages.
Adding the LoggingHandler from Netty tells me in these cases:
11:28:48.576 [nioEventLoopGroup-3-1] WARN i.n.handler.logging.LoggingHandler - [id: 0x9991c251, L:/192.168.0.20:1234 - R:/192.168.0.105:63845] REGISTERED
11:28:48.577 [nioEventLoopGroup-3-1] WARN i.n.handler.logging.LoggingHandler - [id: 0x9991c251, L:/192.168.0.20:1234 - R:/192.168.0.105:63845] ACTIVE
In the cases where the message is received it tells me:
11:30:01.392 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 - R:/192.168.0.105:59927] REGISTERED
11:30:01.394 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 - R:/192.168.0.105:59927] ACTIVE
11:30:01.439 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 - R:/192.168.0.105:59927] READ: 8B
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 54 65 73 74 20 32 0d 0a |Test 2.. |
+--------+-------------------------------------------------+----------------+
11:30:01.449 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 - R:/192.168.0.105:59927] CLOSE
11:30:01.451 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 ! R:/192.168.0.105:59927] READ COMPLETE
11:30:01.453 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 ! R:/192.168.0.105:59927] INACTIVE
11:30:01.464 [nioEventLoopGroup-3-6] WARN i.n.handler.logging.LoggingHandler - [id: 0xd51b7bc3, L:/192.168.0.20:1234 ! R:/192.168.0.105:59927] UNREGISTERED
With my understanding this means that the TCP packets are indeed received but in the faulty cases the IO thread from Netty is waiting to read the TCP data but does never continue...
The same problem exists when trying with a rudimentary python server (just waiting for a connection and printing the received data).
I confirmed the data is sent by using tcpflow on Arch Linux with the arguments -i any -C -g port 1234.
I even tried the server on a Windows 7 machine with the same results (TCP packets confirmed with SmartSniff).
Strangely using a java server to send the data always and reproducibly is received...
Does anybody have any idea to solve the problem or at least how to diagnose?
PS: Maybe it is important to note that with tcpflow (i.e. on linux) I could watch the TCP packets being resent to the server.
Does this mean the server is receiving the packets but not sending an ACK?
SmartSniff didn't show the same behavior (but maybe I used wrong options to display the resent packets).
In the meantime I send messages to acknowledge receiving another message. If the acknowledgement is not received the message is sent again.
For anyone with the same problem:
While testing something different I updated the wifi firmware of the board to the latest version 19.5.2. Since then I haven't noticed any lost data. Maybe this was the problem.
See Check WiFi101 Firmware Version and Firmware and certificates Updater.
Note: I couldn't get the sketches to run with the Arduino IDE but with PlatformIO.

groovy unknown host exception with REST client

The below code returns an exception even though the provided REST endpoint is up and valid. It is processed correctly as the DEBUG prompt shows the link of the GET request. It fails at the http.request line regardless of the REST endpoint provided. This is being executed by hitting Run 'MyScript' on intelliJ 14.1 .. Is there something missing to this piece of code? Source: github.com/jgritman/httpbuilder/wiki/GET-Examples
11:42:30.897 [main] DEBUG groovyx.net.http.HTTPBuilder - GET http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Calvin+and+Hobbes
Caught: java.net.UnknownHostException: ajax.googleapis.com
MyScript.groovy
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.RESTClient
import groovyx.net.http.Method
def http = new HTTPBuilder()
http.request( 'http://ajax.googleapis.com', Method.GET, ContentType.JSON ) { req ->
uri.path = '/ajax/services/search/web'
uri.query = [ v:'1.0', q: 'Calvin and Hobbes' ]
headers.'User-Agent' = "Mozilla/5.0 Firefox/3.0.4"
headers.Accept = 'application/json'
response.success = { resp, reader ->
assert resp.statusLine.statusCode == 200
println "Got response: ${resp.statusLine}"
println "Content-Type: ${resp.headers.'Content-Type'}"
println reader.text
}
response.'404' = {
println 'Not found'
}
}
Run MyScript.groovy exceptions
11:52:32.133 [main] DEBUG groovyx.net.http.HTTPBuilder - GET http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Calvin+and+Hobbes
11:52:32.395 [main] DEBUG o.a.h.i.c.BasicClientConnectionManager - Get connection for route {}->http://ajax.googleapis.com
11:52:32.413 [main] DEBUG o.a.h.i.conn.DefaultClientConnection - Connection org.apache.http.impl.conn.DefaultClientConnection#2b175c00 closed
11:52:32.413 [main] DEBUG o.a.h.i.conn.DefaultClientConnection - Connection org.apache.http.impl.conn.DefaultClientConnection#2b175c00 shut down
11:52:32.414 [main] DEBUG o.a.h.i.c.BasicClientConnectionManager - Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl#3eb81efb
11:52:32.414 [main] DEBUG o.a.h.i.c.BasicClientConnectionManager - Connection can be kept alive for 9223372036854775807 MILLISECONDS
Caught: java.net.UnknownHostException: ajax.googleapis.com
java.net.UnknownHostException: ajax.googleapis.com