mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.81k stars 1.65k forks source link

Bug when send binary data #755

Open wettper opened 4 years ago

wettper commented 4 years ago

Buy when send binary, there happened circular reference, but the same binary data sometimes has problems, sometimes normal

how i call :

@Override
public void sendEvent(String name, Object... data) {
    Packet packet = new Packet(PacketType.MESSAGE);
    packet.setSubType(PacketType.EVENT);
    packet.setName(name);
    packet.setData(Arrays.asList(data));
    send(packet);
}

and i have try:

@Override
public void sendEvent(String name, Object... data) {
    Packet packet = new Packet(PacketType.MESSAGE);
    packet.setSubType(PacketType.BINARY_EVENT);
    packet.setName(name);
    packet.setData(Arrays.asList(data));
    send(packet);
}
Error content: 
org.redisson.client.RedisException: Unexpected exception while processing command
    at org.redisson.command.CommandAsyncService.convertException(CommandAsyncService.java:320)
    at org.redisson.command.CommandAsyncService.get(CommandAsyncService.java:165)
    at org.redisson.RedissonTopic.publish(RedissonTopic.java:61)
    at com.corundumstudio.socketio.store.RedissonPubSubStore.publish(RedissonPubSubStore.java:50)
  .....
  .....
  Caused by: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]->io.netty.buffer.EmptyByteBuf["alloc"]->io.netty.buffer.UnpooledByteBufAllocator["emptyBuf"]
.....
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
......
Caused by: java.lang.StackOverflowError: null
    at java.lang.Exception.<init>(Exception.java:66)
    at java.io.IOException.<init>(IOException.java:58)
    at com.fasterxml.jackson.core.JsonProcessingException.<init>(JsonProcessingException.java:25)
    at com.fasterxml.jackson.core.JsonProcessingException.<init>(JsonProcessingException.java:41)
    at com.fasterxml.jackson.databind.JsonMappingException.<init>(JsonMappingException.java:251)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:706)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)
......
wettper commented 4 years ago

Use version is

<dependency>
   <groupId>com.corundumstudio.socketio</groupId>
   <artifactId>netty-socketio</artifactId>
   <version>1.7.12</version>
</dependency>
<dependency>
   <groupId>org.redisson</groupId>
   <artifactId>redisson</artifactId>
   <version>2.8.1</version>
</dependency>
wettper commented 4 years ago

@mrniko

mrniko commented 4 years ago

Did you try to use 1.7.18 version?

wettper commented 4 years ago

Did you try to use 1.7.18 version?

Did you mean version of 1.7.18 has been fixed this bug,I have try 1.7.14