{"action":"opened","issue":{"url":"https://api.github.com/repos/redisson/redisson/issues/1205","repository_url":"https://api.github.com/repos/redisson/redisson","labels_url":"https://api.github.com/repos/redisson/redisson/issues/1205/labels{/name}","comments_url":"https://api.github.com/repos/redisson/redisson/issues/1205/comments","events_url":"https://api.github.com/repos/redisson/redisson/issues/1205/events","html_url":"https://github.com/redisson/redisson/issues/1205","id":284365497,"number":1205,"title":"MapCache listener not working on cross-plateform environment","user":{"login":"ZongoForSpeed","id":13649539,"avatar_url":"https://avatars2.githubusercontent.com/u/13649539?v=4","gravatar_id":"","url":"https://api.github.com/users/ZongoForSpeed","html_url":"https://github.com/ZongoForSpeed","followers_url":"https://api.github.com/users/ZongoForSpeed/followers","following_url":"https://api.github.com/users/ZongoForSpeed/following{/other_user}","gists_url":"https://api.github.com/users/ZongoForSpeed/gists{/gist_id}","starred_url":"https://api.github.com/users/ZongoForSpeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZongoForSpeed/subscriptions","organizations_url":"https://api.github.com/users/ZongoForSpeed/orgs","repos_url":"https://api.github.com/users/ZongoForSpeed/repos","events_url":"https://api.github.com/users/ZongoForSpeed/events{/privacy}","received_events_url":"https://api.github.com/users/ZongoForSpeed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-24T14:23:24Z","updated_at":"2017-12-24T14:23:24Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nI've encountered a bizarre bug when using MapCache listeners between windows and linux.\r\nMy setup:\r\nredisson 3.5.6\r\nredis 3.2.11 on ubuntu 16.04\r\n\r\n`Config config = new Config();\r\n    config.useSingleServer().setAddress(\"redis://************:6379\");\r\n    RedissonClient redisson = Redisson.create(config);\r\n    \r\n    RMapCache<String, Integer> mapCache = redisson.getMapCache(\"test\");\r\n    \r\n    mapCache.addListener((EntryCreatedListener) event -> System.out.println(\"onCreated(\" + event.getKey() + \", \" + event.getValue() + \")\"));\r\n    mapCache.addListener((EntryUpdatedListener) event -> System.out.println(\"onUpdated(\" + event.getKey() + \", \" + event.getValue() + \")\"));\r\n    mapCache.addListener((EntryRemovedListener) event -> System.out.println(\"onCreated(\" + event.getKey() + \", \" + event.getValue() + \")\"));\r\n    mapCache.addListener((EntryExpiredListener) event -> System.out.println(\"onExpired(\" + event.getKey() + \", \" + event.getValue() + \")\"));\r\n    \r\n    // with ttl = 10 seconds\r\n    Integer prevValue = mapCache.put(\"1\", 10, 10, TimeUnit.SECONDS);\r\n    // ... the rest is exactly the same code as in the class MapCacheExamples found in the redisson-examples project\r\n`\r\n\r\nWhen running the test I've got the following errors:\r\n`[redisson-netty-1-4] WARN io.netty.channel.DefaultChannelPipeline - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.\r\nio.netty.handler.codec.DecoderException: com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 0)): only regular white space (\\r, \\n, \\t) is allowed between tokens\r\n at [Source: io.netty.buffer.ByteBufInputStream@1fd104f3; line: 1, column: 2]\r\n`\r\n(cf. the attached file for all the callstack\r\n[exception.log.txt](https://github.com/redisson/redisson/files/1584870/exception.log.txt )\r\n\r\nThe code runs correctly when connecting to a redis server running on windows.\r\n\r\nThe error seems to come from the class **MapCacheEventCodec**:\r\n`    private Object decode(ByteBuf buf, State state, Decoder<?> decoder) throws IOException {\r\n        int keyLen;\r\n        if (PlatformDependent.isWindows()) {\r\n            keyLen = buf.readIntLE();\r\n        } else {\r\n            keyLen = (int) buf.readLongLE();\r\n        }\r\n        ByteBuf keyBuf = buf.readSlice(keyLen);\r\n        Object key = decoder.decode(keyBuf, state);\r\n        return key;\r\n    }`\r\nthe line **PlatformDependent.isWindows()** should not be made regarding to the jvm running environnement but regarding to the redis server.\r\n\r\n\r\n"}}
{"actor":{"display_login":"ZongoForSpeed"}}