Comments (7)
@survivant When you have a chance, can you take a look :-) In exchange I will look at your session issue :-)
from nettosphere.
I'll take a look. Look like you are parsing the ping like a Event message.
PS. In the current Atmosphere Socket.io, I found out that there is a concurency problem when writing the data on the response. Something it write a event, and write a ping or Ack in the same response, that will cause the client to crash, because the message delimiter is not present.
I'm working on a fix to allow only 1 thread to write in the same time on the response. The problem is not present using websocket.
from nettosphere.
I commited 2 issues fix for socket.io Atmosphere/atmosphere-extensions@4a3692a
Atmosphere/atmosphere-extensions@0005eb8
from nettosphere.
Just to be sure that you handle all the Socket.io message type. here the list :
https://github.com/Atmosphere/atmosphere-extensions/blob/master/socketio/modules/src/main/java/org/atmosphere/socketio/transport/SocketIOPacketImpl.java
public enum PacketType {
UNKNOWN(-1),
DISCONNECT(0),
CONNECT(1),
HEARTBEAT(2),
MESSAGE(3),
JSON(4),
EVENT(5),
ACK(6),
ERROR(7),
NOOP(8);
they can all have different format too :)
and messages can be separated by delimiter :
public static final char SOCKETIO_MSG_DELIMITER = '\ufffd';
if (padding) {
sb = new StringBuilder();
sb.append(SOCKETIO_MSG_DELIMITER).append(msg.length()).append(SOCKETIO_MSG_DELIMITER).append(msg);
msg = sb.toString();
}
from nettosphere.
FYI, it seems like the socketio sample app is still broken (tested with 1.1.0.beta2
which version seems to contain the fix mentioned above i.e. Atmosphere/atmosphere-extensions@0005eb8)
from nettosphere.
Fixed as of Feb 28. Tested using the sample and the latest SocketIO and Atmosphere 1.1.0-SNAPSHOT jars.
from nettosphere.
I can reproduce this error with SocketIO and Atmosphere 1.1.0-SNAPSHOT jars.
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
at java.lang.String.substring(Unknown Source) ~[na:1.6.0_41]
at org.nettosphere.samples.chat.SocketIOChatAtmosphereHandler.onStateChange(SocketIOChatAtmosphereHandler.java:54) ~[classes/:na]
at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1085) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1105) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:989) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:626) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_41]
at java.lang.Thread.run(Unknown Source) [na:1.6.0_41]
15:22:13.793 [Atmosphere-Shared-AsyncOp-1] DEBUG o.atmosphere.cpr.DefaultBroadcaster - onException()
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
at java.lang.String.substring(Unknown Source) ~[na:1.6.0_41]
at org.nettosphere.samples.chat.SocketIOChatAtmosphereHandler.onStateChange(SocketIOChatAtmosphereHandler.java:54) ~[classes/:na]
at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1085) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1105) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:989) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:626) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_41]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_41]
at java.lang.Thread.run(Unknown Source) [na:1.6.0_41]
After that, when I try to connect again I am getting stackoverflow error.
GET /chat/1/xhr-polling/DCD3081F464EAFCFAA91C510E1C540206871FACD?t=1362835458001 HTTP/1.1
Accept: */*
Accept-Language: en-us
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Host: localhost:8080
Connection: Keep-Alive
15:24:18.033 [New I/O worker #2] ERROR o.a.n.NettyAtmosphereHandler - Unable to process request
java.lang.StackOverflowError: null
at sun.misc.Unsafe.compareAndSwapInt(Native Method) ~[na:1.6.0_41]
at java.util.concurrent.atomic.AtomicBoolean.compareAndSet(Unknown Source) ~[na:1.6.0_41]
at java.util.concurrent.atomic.AtomicBoolean.getAndSet(Unknown Source) ~[na:1.6.0_41]
at org.atmosphere.cpr.AtmosphereResponse.writeStatusAndHeaders(AtmosphereResponse.java:623) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse.access$1100(AtmosphereResponse.java:53) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:549) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
from nettosphere.
Related Issues (20)
- request.body().asBytes() always returns null HOT 2
- Empty response for NOT_MODIFIED (304) return for static files
- Error in Ping without Playload HOT 1
- Disable chunked response for HTTP/1.0
- Upload file problem (Entity Too Large) HOT 2
- NettyWebSocket.isOpen() fails with NullPointerException. HOT 2
- Possible NPE when config.webSocketOnly() is used
- Content-Length not set in Http response HOT 2
- Cannot stop Nettosphere HOT 5
- Nettosphere does not fully shutdown in unit tests
- Nettosphere does not fully shutdown in unit tests HOT 1
- Nettosphere does not handle ContinuationWebSocketFrame(s) properly.
- travis CI fails with dist: not set to trusty
- Unexpected and unhandled exception while closing the WebSocket connection
- atmosphere2.2.1, a POST request (header include 'Expect:100-continue') got exception: java.lang.UnsupportedOperationException HOT 1
- SSL WebSocket exception - Received fatal alert: certificate_unknown HOT 49
- SSL Example HOT 1
- Server:Nettosphere/3.2.7 HOT 2
- onReady() not invoked when using supportChunking(false) HOT 1
- Upgrade path from javax to Jakarta HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nettosphere.