mrniko / netty-socketio-demo

netty-socketio demo
880 stars 546 forks source link

Bug when send binary data #47

Open wettper opened 4 years ago

wettper commented 4 years ago

same question: https://github.com/mrniko/netty-socketio/issues/755

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

@mrniko

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>