Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SyntaxError: Unexpected end of JSON input #94

Closed
lmj0011 opened this issue Jun 30, 2016 · 17 comments
Closed

Uncaught SyntaxError: Unexpected end of JSON input #94

lmj0011 opened this issue Jun 30, 2016 · 17 comments

Comments

@lmj0011
Copy link

lmj0011 commented Jun 30, 2016

Nothing has changed in my code since upgrading from v1.4.5 to v1.5.0, however, I'm getting this syntax error when sending message between clients:

chat1

The JSON is being broken somehow:

{
    "method": "join",
    "body": {
        "channel": "testsite:575e286967c52:sim1",
        "data": {
            "default_info": {
                "user_data": {
                    "id": 3,
                    "username": "sim1",
                    "rank": 100,
                    "zip": "56894",
                    "href": "http://www.testsite.com/users/sim1",
                    "last_login_at": "1467261409"
                }
            },
            "user": "3",
            "client": "855cdfc3-5dd6-4af4-b005-fc12653f780  //here string is not terminated and missing '}'

This prevents my messages from being sent.


for my app I'm using:
front-end: centrifuge-js
back-end: centrifugo-1.5.0-linux-amd64

@FZambia
Copy link
Member

FZambia commented Jun 30, 2016

Hello! Do you use Memory or Redis engine? Is this reproduced all the time?

@lmj0011
Copy link
Author

lmj0011 commented Jun 30, 2016

The default, Memory.
It's reproduced everytime.

@FZambia
Copy link
Member

FZambia commented Jun 30, 2016

Hm.. Can't find what can cause this bug, and can not reproduce it. Could you post all websocket messages from chrome network console (Network -> WS)?

@FZambia
Copy link
Member

FZambia commented Jun 30, 2016

I will also try that particular build as soon as I get to linux machine.

@FZambia
Copy link
Member

FZambia commented Jun 30, 2016

Just tried to run on Centos 6 – works well... Could you also show the output of these 2 commands from machine where Centrifugo running (maybe you are using wrong build for your architecture)?

uname -a

and

cat /proc/cpuinfo

@lmj0011
Copy link
Author

lmj0011 commented Jun 30, 2016

Just tried to run on Centos 6 – works well... Could you also show the output of these 2 commands from machine where Centrifugo running (maybe you are using wrong build for your architecture)?

uname -a
and

cat /proc/cpuinfo

forge@forge-virtual-machine:~/www/client1/BGateway$ uname -a
Linux forge-virtual-machine 3.19.0-49-generic #55-Ubuntu SMP Fri Jan 22 02:10:24 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


forge@forge-virtual-machine:~/www/client1/BGateway$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 26
model name  : Intel(R) Xeon(R) CPU           W3565  @ 3.20GHz
stepping    : 5
microcode   : 0x19
cpu MHz     : 3200.000
cache size  : 8192 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer hypervisor lahf_lm ida dtherm tsc_adjust
bugs        :
bogomips    : 6400.00
clflush size    : 64
cache_alignment : 64
address sizes   : 42 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 26
model name  : Intel(R) Xeon(R) CPU           W3565  @ 3.20GHz
stepping    : 5
microcode   : 0x19
cpu MHz     : 3200.000
cache size  : 8192 KB
physical id : 2
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 2
initial apicid  : 2
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer hypervisor lahf_lm ida dtherm tsc_adjust
bugs        :
bogomips    : 6400.00
clflush size    : 64
cache_alignment : 64
address sizes   : 42 bits physical, 48 bits virtual
power management:

(maybe you are using wrong build for your architecture)?

I'm using the same build I used for v1.4.5

@lmj0011
Copy link
Author

lmj0011 commented Jun 30, 2016

Hm.. Can't find what can cause this bug, and can not reproduce it. Could you post all websocket messages from chrome network console (Network -> WS)?

Nothing shows in the Network section of Chrome Web Console for this

@FZambia
Copy link
Member

FZambia commented Jun 30, 2016

Can you write into gitter chat - more comfortable to chat when debugging

@lmj0011
Copy link
Author

lmj0011 commented Jul 1, 2016

this is the data I'm sending in new Centrifuge({})

let data = '{"user_data":'+ JSON.stringify(this.app.whoiami) +'}';

this.app.whoiami is just an object with some user properties, just like in the original post^^

@FZambia
Copy link
Member

FZambia commented Jul 1, 2016

Could you post all the code? Including new Centrifuge(..., subscription, publish etc? Because join messages use connection parameters. Also websocket frames can provide a great help (https://stackoverflow.com/questions/5751495/debugging-websocket-in-google-chrome)

@FZambia
Copy link
Member

FZambia commented Jul 5, 2016

@lmj0011 any news on this?

@lmj0011
Copy link
Author

lmj0011 commented Jul 5, 2016

Give me until the end of the week to update this with more code. Sorry I've been quite busy. This Sunday at the latest.

@FZambia
Copy link
Member

FZambia commented Jul 8, 2016

@lmj0011 just reproduced this! will try to fix asap.

@lmj0011
Copy link
Author

lmj0011 commented Jul 8, 2016

👍😀 that's great. Now I don't have to upload my confusing code

@FZambia
Copy link
Member

FZambia commented Jul 9, 2016

@lmj0011 hope fixed this in 1.5.1 – could you check it out?

@lmj0011
Copy link
Author

lmj0011 commented Jul 11, 2016

Just tested it, was not able to reproduce the error.
👍

@FZambia
Copy link
Member

FZambia commented Jul 11, 2016

Cool! Thanks for report!

@FZambia FZambia closed this as completed Jul 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants