-
Notifications
You must be signed in to change notification settings - Fork 185
Duplicate h$listProps #556
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
Comments
We had the same problem at, and we submitted
ghcjs/ghcjs-base#70 as a fix. However, it seems
nobody is tending the PRs upstream at the moment.
…---------- Forwarded message ----------
From: John Lenz <notifications@github.com>
Date: Mon, Dec 19, 2016 at 11:22 AM
Subject: [ghcjs/ghcjs] Duplicate h$listProps (#556)
To: ghcjs/ghcjs <ghcjs@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
I recently updated ghcjs (8.0 git branch), and started getting
ThreadAborted errors "TypeError: Cannot read property 't' of undefined"
inside the runtime, specifically in the function where h$RTS_580 was
undefined.
function h$e(h$RTS_579)
{
h$r1 = h$RTS_579;
if((typeof h$RTS_579 !== "object"))
{
return h$rs();
};
var h$RTS_580 = h$RTS_579.f;
if((h$RTS_580 === h$unbox_e))
{
h$r1 = h$RTS_579.d1;
return h$rs();
};
switch (h$RTS_580.t)
{
case (2):
case (1):
case (3):
return h$rs();
case (5):
h$p3(h$ap_0_0, h$RTS_579, h$return);
return h$blockOnBlackhole(h$RTS_579);
default:
return h$RTS_580;
};
};
After single-stepping in the chrome debugger, I eventually traced it to the
following problem:
Step 1: I am using the FromJSVal instance for Aeson.Value located in
GHCJS.Marshal, which calls listProps from JavaScript.Object.Internal.
Step 2: listProps is unsafeCoerce (js_listProps o) and js_listProps is a
foreign call to h$listProps
Step 3: h$listProps is defined in https://github.com/ghcjs/
ghcjs-base/blob/master/jsbits/utils.js and properly creates a haskell value
containing the properties of the object. So far everything is great.
Problem!: The shim code also contains a function h$listProps:
https://github.com/ghcjs/shims/blob/master/src/object.js (also in 8.0
branch) This version of h$listProps does not create a haskell value but
just a raw javascript list. If this version of h$listProps is used, the raw
javascript list will be unsafeCoerce into a haskell list which eventually
causes the crash.
Speculation: something in ghcjs changed the order in which code is
generated, which exposed this problem. Before, I suspect that the order in
which code was emitted caused the h$listProps from ghcjs-base to be used,
but some recent change in ghcjs changed the code order and now h$listProps
is being used from shims.
In my generated output, there was only a single call to h$listProps which
was coming from the FromJSVal instance, so I just deleted the shim version
of h$listProps from the generated output and everything started working.
But a long-term fix is to rename one of the functions?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#556>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEOWYjySlsW_YKllqRwX1VxlASX23wwks5rJep6gaJpZM4LQUQY>
.
|
I don't think that is the correct fix, since it still relies on the order that code is emitted. If ghcjs ever changes the order so that the ghcjs-base version of h$listProps comes later than the shim version of h$listProps, your code will break. |
That seems to be true, yeah. But in any case, it's a current fix at the moment. The greater issue here though is that all maintainers seem to be MIA. |
Also found the duplicate h$listProps after single-stepping with chrome debugger. I wish I'd found this issue first! |
This issue is not exclusive to 8.0. With the lts-6.20 stack resolver this issue is not reproducible for me, but with lts-6.30 it is (both are GHC 7.10.3). |
This should have been fixed by ghcjs/shims#41 |
I recently updated ghcjs (8.0 git branch), and started getting ThreadAborted errors "TypeError: Cannot read property 't' of undefined" inside the runtime, specifically in the function where h$RTS_580 was undefined.
After single-stepping in the chrome debugger, I eventually traced it to the following problem:
Step 1: I am using the FromJSVal instance for Aeson.Value located in GHCJS.Marshal, which calls listProps from JavaScript.Object.Internal.
Step 2: listProps is
unsafeCoerce (js_listProps o)
andjs_listProps
is a foreign call toh$listProps
Step 3:
h$listProps
is defined in https://github.com/ghcjs/ghcjs-base/blob/master/jsbits/utils.js and properly creates a haskell value containing the properties of the object. So far everything is great.Problem!: The shim code also contains a function
h$listProps
: https://github.com/ghcjs/shims/blob/master/src/object.js (also in 8.0 branch) This version ofh$listProps
does not create a haskell value but just a raw javascript list. If this version of h$listProps is used, the raw javascript list will be unsafeCoerce into a haskell list which eventually causes the crash.Speculation: something in ghcjs changed the order in which code is generated, which exposed this problem. Before, I suspect that the order in which code was emitted caused the h$listProps from ghcjs-base to be used, but some recent change in ghcjs changed the code order and now h$listProps is being used from shims.
In my generated output, there was only a single call to h$listProps which was coming from the FromJSVal instance, so I just deleted the shim version of h$listProps from the generated output and everything started working. But a long-term fix is to rename one of the functions?
The text was updated successfully, but these errors were encountered: