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

Already on GitHub? Sign in to your account

Syntax error: h = {}; h[:a] = b = sleep 1 #2004

Closed
chanks opened this Issue Nov 11, 2012 · 9 comments

Comments

Projects
None yet
4 participants

chanks commented Nov 11, 2012

The line in the title throws a SyntaxError on Rubinius master (it requires parentheses around the 1) in both 1.8 and 1.9 modes. MRI 1.9.3 handles this just fine, while 1.8.7 throws a similar error. JRuby 1.7.0 handles this in 1.9 mode but not 1.8 mode.

A simpler reproduction that also fails in the same versions: a = b = sleep 1

Aside from this, and having to drop a C-extension, Rubinius ran my Rails app's test suite without a hitch!

Owner

brixen commented Nov 11, 2012

a = b = foo arg was added in 1.9.3. We just haven't ported that yet. I need to add some machinery to mspec to support syntax changes in teeny versions.

Could you tell us what the C-extension was and what issue you ran into?

chanks commented Nov 11, 2012

Sure, it's the sequel_pg gem. It installs fine, but when I try to start up my app with it I get:

Detected bad handle checking global capi handles
(0.000172s) SET standard_conforming_strings = ON
(0.000143s) SET client_min_messages = 'WARNING'
(0.000127s) SET DateStyle = 'ISO'
(0.000853s) SELECT "oid", "typname" FROM "pg_type" WHERE (("typtype" = 'b') AND ("typname" IN ('hstore')))
(0.000462s) SELECT "oid", "typname" FROM "pg_type" WHERE (("typtype" = 'b') AND ("typname" IN ('hstore')))

---------------------------------------------
CRASH: A fatal error has occurred.

Backtrace:
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx[0x5b9aa0]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10060)[0x7ffd5676c060]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx(_ZN8rubinius7BakerGC7collectERNS_6GCDataEPNS_17YoungCollectStatsE+0x245)[0x732cd5]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx(_ZN8rubinius12ObjectMemory13collect_youngERNS_6GCDataEPNS_17YoungCollectStatsE+0x66)[0x66ae26]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx(_ZN8rubinius12ObjectMemory13collect_maybeEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x216)[0x66b166]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx(_ZN8rubinius2VM13collect_maybeERNS_11GCTokenImplEPNS_9CallFrameE+0x34)[0x69c424]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx[0x6a6831]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx(_ZN8rubinius5Class8allocateEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x131)[0x6a6db1]
/home/chris/.rbenv/versions/rbx-2.0.0-dev/bin/rbx(_ZN8rubinius10Primitives14class_allocateEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xfb)[0x65b84b]
[0x7ffd5743b8fc]

.rubinius_last_error is here: https://gist.github.com/4056109

Owner

dbussink commented Nov 11, 2012

Are you able to create instructions for us so we can reproduce that crash and investigate it?

Member

jeremyevans commented Nov 11, 2012

I've already talked to @brixen about sequel_pg compatibility with rbx. sequel_pg is currently not supported on rbx. @brixen seemed to think the problem is in sequel_pg, but as it works fine in MRI (no reported issues with many users), I think the problem is in rbx's capi support. Running rbx -S rake spec_postgres in a Sequel checkout with sequel_pg installed should reproduce the issue.

Owner

dbussink commented Nov 11, 2012

Well, Rubinius has a moving GC, so any C extension that expects object to stay in the same place will have a potential issue that will never occur in MRI since MRI doesn't move objects. I suspect this is a case like this. Could also very well be the pg gem them, we'll find out then.

Owner

dbussink commented Nov 11, 2012

Ok, I found the problem. It looks like you're registering an address as global variable that is located on the stack. The address on the stack is allocated here (spg_Postgres):

https://github.com/jeremyevans/sequel_pg/blob/master/ext/sequel_pg/sequel_pg.c#L952

It is then assigned a variable and registered as a global variable here:

https://github.com/jeremyevans/sequel_pg/blob/master/ext/sequel_pg/sequel_pg.c#L1012

To be honest, it sounds almost like a miracle to me that this never has been an issue for anyone using MRI.

Owner

dbussink commented Nov 11, 2012

Opened pull request for the sequel_pg issue: jeremyevans/sequel_pg#7

chanks commented Nov 13, 2012

Thanks for your help. I think we can close this, unless you want to keep it as a reminder to port the 1.9.3 syntax?

Owner

brixen commented Nov 13, 2012

@chanks you can leave it open, I'll fix it shortly.

@dbussink dbussink closed this in ee39d2c Aug 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment