Giter Site home page Giter Site logo

Comments (7)

jfarcand avatar jfarcand commented on August 10, 2024

@survivant When you have a chance, can you take a look :-) In exchange I will look at your session issue :-)

from nettosphere.

survivant avatar survivant commented on August 10, 2024

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.

survivant avatar survivant commented on August 10, 2024

I commited 2 issues fix for socket.io Atmosphere/atmosphere-extensions@4a3692a

Atmosphere/atmosphere-extensions@0005eb8

from nettosphere.

survivant avatar survivant commented on August 10, 2024

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.

pk11 avatar pk11 commented on August 10, 2024

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.

jfarcand avatar jfarcand commented on August 10, 2024

Fixed as of Feb 28. Tested using the sample and the latest SocketIO and Atmosphere 1.1.0-SNAPSHOT jars.

from nettosphere.

tahaozket avatar tahaozket commented on August 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.