Error found on console: "Failed to read input"

I’m seeking some help regarding the dwr error found on console after observing the behavior for a while.
Tested with version 2.0.3 and 2.0.11.

Sometimes a request fails, as follows…

Error message on console:

engine.js:1311 Error: org.directwebremoting.extend.ServerException, Failed to read input

After this trace:

| dwr.engine._debug | @ | engine.js:1310
| dwr.engine._handleError | @ | engine.js:1077
| dwr.engine._remoteHandleBatchException | @ | engine.js:941
| (anonymous) | @ | VM505:3
| dwr.engine._eval | @ | engine.js:980
| dwr.engine._stateChange | @ | engine.js:869
| batch.req.onreadystatechange | @ | engine.js:646
| XMLHttpRequest.send (async) | |
| dwr.engine._sendData | @ | engine.js:678
| dwr.engine.endBatch | @ | engine.js:212
| dwr.engine._execute | @ | engine.js:403
| MyDwr.isActive | @ | MyDwr.js:84
| setInterval (async) | |
| n | @ | jquery.js:2
| fireWith | @ | jquery.js:2
| ready | @ | jquery.js:2
| B | @ | jquery.js:2

First I would recommend you to upgrade to the latest DWR 3 version. DWR 2 is no longer being maintained.

The error you are seeing means that the appserver is complaining about not receiving the announced data from the browser. This usually doesn’t mean there is an actual application bug but rather is correlated to environmental factors, user behaviour (pressing abort or refresh?) or browser quirks.

You can find more info on our old forum archive at Nabble, f ex these threads:
http://dwr.2114559.n2.nabble.com/Input-Read-Failed-Failed-HTTP-POST-td5405611.html
http://dwr.2114559.n2.nabble.com/Failed-to-Read-Input-td5404962.html

Hello, Mike!
Thank you for the reply.
I’ll analyse the suggestion on the post and also try the new version.

After testing multiple versions and finally 3.0.2RELEASE, I still got the same message: “Failed to read Input”.

Well, I hope it leads somehow to understanding why it happens.
One difference I could observe testing in different servers is that the more loaded (more number of apps in the appServer) would throw the error more often.

The stacktrace is this one below:

engine.js:984 console.trace
dwr.engine._debug @ engine.js:984
(anonymous) @ SWB_events.shtm:99
(anonymous) @ engine.js:794
logHandlerEx @ engine.js:2553
(anonymous) @ engine.js:791
ignoreIfUnloading @ engine.js:601
dwr.engine._handleError @ engine.js:772
validate @ engine.js:2442
complete @ engine.js:1568
stateChange @ engine.js:1792
batch.req.onreadystatechange @ engine.js:1664
XMLHttpRequest.send (async)
send @ engine.js:1691
send2 @ engine.js:1561
send @ engine.js:1525
dwr.engine.endBatch @ engine.js:279
dwr.engine._execute @ engine.js:694
p.doLongPoll @ MiscDwr.js:256
mango.longPoll.poll @ common.js:75
setTimeout (async)
mango.longPoll.pollCB @ common.js:118
(anonymous) @ engine.js:1037
logHandlerEx @ engine.js:2553
handleCallback @ engine.js:1033
(anonymous) @ VM51:10
(anonymous) @ VM51:11
dwr.engine._executeScript @ engine.js:720
stateChange @ engine.js:1791
batch.req.onreadystatechange @ engine.js:1664
XMLHttpRequest.send (async)
send @ engine.js:1691
send2 @ engine.js:1561
send @ engine.js:1525
dwr.engine.endBatch @ engine.js:279
dwr.engine._execute @ engine.js:694
p.doLongPoll @ MiscDwr.js:256
mango.longPoll.poll @ common.js:75
setTimeout (async)
mango.longPoll.pollCB @ common.js:118
(anonymous) @ engine.js:1037
logHandlerEx @ engine.js:2553
handleCallback @ engine.js:1033
(anonymous) @ VM45:10
(anonymous) @ VM45:11
dwr.engine._executeScript @ engine.js:720
stateChange @ engine.js:1791
batch.req.onreadystatechange @ engine.js:1664
XMLHttpRequest.send (async)
send @ engine.js:1691
send2 @ engine.js:1561
send @ engine.js:1525
dwr.engine.endBatch @ engine.js:279
dwr.engine._execute @ engine.js:694
p.doLongPoll @ MiscDwr.js:256
mango.longPoll.poll @ common.js:75
setTimeout (async)
mango.longPoll.pollCB @ common.js:118
(anonymous) @ engine.js:1037
logHandlerEx @ engine.js:2553
handleCallback @ engine.js:1033
(anonymous) @ VM39:10
(anonymous) @ VM39:11
dwr.engine._executeScript @ engine.js:720
stateChange @ engine.js:1791
batch.req.onreadystatechange @ engine.js:1664
XMLHttpRequest.send (async)
send @ engine.js:1691
send2 @ engine.js:1561
send @ engine.js:1525
dwr.engine.endBatch @ engine.js:279
dwr.engine._execute @ engine.js:694
p.doLongPoll @ MiscDwr.js:256
mango.longPoll.poll @ common.js:75
mango.longPoll.pollCB @ common.js:123
(anonymous) @ engine.js:1037
logHandlerEx @ engine.js:2553
handleCallback @ engine.js:1033
(anonymous) @ VM38:10
(anonymous) @ VM38:11
dwr.engine._executeScript @ engine.js:720
stateChange @ engine.js:1791
batch.req.onreadystatechange @ engine.js:1664
engine.js:985 Error: org.directwebremoting.extend.ServerException, Failed to read input

Another example:

engine.js:984 console.trace
dwr.engine._debug @ engine.js:984
(anonymous) @ advanced.shtm:90
(anonymous) @ engine.js:794
logHandlerEx @ engine.js:2553
(anonymous) @ engine.js:791
ignoreIfUnloading @ engine.js:601
dwr.engine._handleError @ engine.js:772
validate @ engine.js:2442
complete @ engine.js:1568
stateChange @ engine.js:1792
batch.req.onreadystatechange @ engine.js:1664
XMLHttpRequest.send (async)
send @ engine.js:1691
send2 @ engine.js:1561
send @ engine.js:1525
dwr.engine.endBatch @ engine.js:279
dwr.engine._execute @ engine.js:694
p.getActiveAlarmCountByUser @ MiscDwr.js:217
(anonymous) @ advanced.shtm:283
setInterval (async)
(anonymous) @ advanced.shtm:273
n @ jquery.js:2
fireWith @ jquery.js:2
ready @ jquery.js:2
B @ jquery.js:2
engine.js:985 Error: org.directwebremoting.extend.ServerException, Failed to read input

Ok so as I said previously this is an error occurring on the server. The stack trace you see on the client shows that a call was made to the server and an error response from the server was (successfully) transmitted back to the client. So there’s nothing to see really from the client side.

The question is what is going on with the server. You should check the server log and look for the cause of the org.directwebremoting.extend.ServerException that was echoed back to the client. There will always be a nested exception.