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

Observatory when compiled to JavaScript gets DecodeException on well formed JSON #18385

Closed
johnmccutchan opened this issue Apr 22, 2014 · 19 comments
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue library-convert P0 A serious issue requiring immediate resolution web-dart2js

Comments

@johnmccutchan
Copy link
Contributor

Observatory when compiled to JavaScript gets DecodeException on well formed JSON.

DecodeException: Error: number is not a function

@johnmccutchan
Copy link
Contributor Author

Marked this as blocking #18358.

@johnmccutchan
Copy link
Contributor Author

Attached is json-parse.js which is a single call to JSON.parse with the JSON string that failed to decode in dart2js.

Note that d8 has no problem parsing it.


Attachment:
json-parse.js (898.53 KB)

@johnmccutchan
Copy link
Contributor Author

Reproduction steps:

Using a bleeding_edge build:

  1. git clone https://github.com/dart-lang/dart-box2d.git
  2. dart --enable-vm-service --pause-isolates-on-exit example/benchmarks/benchmark_runner.dart
  3. Connect to localhost:8181 and click on the profile link.
  4. Hit on-page-refresh button (upper right corner) on the profile page until you get the decode error.

@johnmccutchan
Copy link
Contributor Author

Couple of other notes:

  1. I've never seen this issue when running the Dart version of Observatory.
  2. The JSON is valid (I've tested with multiple JSON lint tools) and d8 will parse it.

@johnmccutchan
Copy link
Contributor Author

Attached is a trivial reproduction program written in Dart that when compiled to JavaScript fails to execute. The call stack from dart2js compiled program:

$ dart2js -o test.js json-parse.dart
$ d8 test.js

/usr/local/google/home/johnmccutchan/test.js:1205: TypeError: number is not a function
        map.$indexSet(0, key, t1.call$2(key, this.call$1(e[key])));
            ^
TypeError: number is not a function
    at _convertJsonToDart_walk.call$1 (/usr/local/google/home/johnmccutchan/test.js:1205:13)
    at _convertJsonToDart_walk.call$1 (/usr/local/google/home/johnmccutchan/test.js:1205:34)
    at _convertJsonToDart_walk.call$1 (/usr/local/google/home/johnmccutchan/test.js:1205:34)
    at _convertJsonToDart_walk.call$1 (/usr/local/google/home/johnmccutchan/test.js:1198:24)
    at _convertJsonToDart_walk.call$1 (/usr/local/google/home/johnmccutchan/test.js:1205:51)
    at dart._convertJsonToDart (/usr/local/google/home/johnmccutchan/test.js:1165:70)
    at dart._parseJson (/usr/local/google/home/johnmccutchan/test.js:1181:14)
    at JsonCodec.decode$2$reviver (/usr/local/google/home/johnmccutchan/test.js:1222:16)
    at JsonCodec.decode$1 (/usr/local/google/home/johnmccutchan/test.js:1225:19)
    at dart.main (/usr/local/google/home/johnmccutchan/test.js:1398:42)


Attachment:
json-parse.dart (898.58 KB)

@rakudrama
Copy link
Member

This looks like a V8 bug.
The program from #­5 is attached

$ third_party/d8/linux/d8 out.js
Crashes like above

$ third_party/firefox_jsshell/linux/js out.js
Runs fine.

V8 version 3.25.28.11

@rakudrama
Copy link
Member


Attachment:
out.js (1.08 MB)

@johnmccutchan
Copy link
Contributor Author

@anders-sandholm
Copy link
Contributor

Removed Library-Json label.
Added Library-Convert label.

@floitschG
Copy link
Contributor

Issue #18436 has been merged into this issue.

1 similar comment
@floitschG
Copy link
Contributor

Issue #18436 has been merged into this issue.

@lrhn
Copy link
Member

lrhn commented May 5, 2014

Issue #18616 has been merged into this issue.

@alan-knight
Copy link
Contributor

Issue #18689 has been merged into this issue.

@DartBot
Copy link

DartBot commented May 28, 2014

This comment was originally written by magus...@gmail.com


Hi guys, I noticed on Issue #18436 that floitsch commented this is already fixed in bleeding edge (that was around the end of April). Do you know what dev build it is fixed in, or better yet what stable release it should come in?

@johnmccutchan
Copy link
Contributor Author

Hi,

This was actually a bug in V8 and was fixed in Chrome 35.

John

@DartBot
Copy link

DartBot commented May 29, 2014

This comment was originally written by magus...@gmail.com


Oh really...interesting. Because I think I have a potentially similar error. I guess I'll have to wait till I'm in work again tomorrow to try an replicate it (shouldn't be hard hopefully) but essentially AFAICT it's a similar error with "number is not a function" message...

I'd have to check to be absolutely sure, but I don't know of any reason why it wouldn't have been Chrome 35 that I was using.

@DartBot
Copy link

DartBot commented May 29, 2014

This comment was originally written by magusofic...@gmail.com


Actually sorry...I didn't realise Chrome 35 only went stable so recently. May I was using Chrome 34 after all...I'm a bit confused now as to when I first encountered this error :/ But at least now it seems like it's not occurring any more.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Has this issue gone away with Chrome 35?

@kasperl
Copy link

kasperl commented Jun 4, 2014

I guess we don't expect to take any action on this on the Dart side. Marking as 'not planned'.


Added NotPlanned label.

@johnmccutchan johnmccutchan added Type-Defect P0 A serious issue requiring immediate resolution web-dart2js library-convert closed-not-planned Closed as we don't intend to take action on the reported issue labels Jun 4, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue library-convert P0 A serious issue requiring immediate resolution web-dart2js
Projects
None yet
Development

No branches or pull requests

8 participants