-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
Different usage of _private inside xmlNode resulting in crashes #939
Comments
Could anyone shed some light on this issue? Is there a way this can be fixed? I think this could crash MRI as well at unexpected moments. |
Anyone who could help out with this issue? I'd love to help out with a fix, but don't really have an idea whether any of you have good suggestions for what would be a good approach to do so. |
I'm also seeing a lot of crashes on Rubinius. Any updates? |
yeah, no chance to deploy reliable xmpp bots w/o a fix for this one if you sit on adhearsion/blather. my bots crash way too often. |
I've created a pull request that fixes the problem. This gets all the tests passing on Rubinius as well. |
Great job @dbussink, I'll give it a try |
When running the test suite on Rubinius, it results in consistent crashes. From what I've gathered, it seems that assumptions about what
_private
contains inxmlNode
are not always correct.Here a VALUE is stored inside
_private
:https://github.com/sparklemotion/nokogiri/blob/master/ext/nokogiri/xml_node.c#L1441-L1442
The crash happens when calling the mark function for an XML node:
https://github.com/sparklemotion/nokogiri/blob/master/ext/nokogiri/xml_node.c#L17
This uses the DOC_RUBY_OBJECT macro. This macro assumes that
_private
inside the document for this node is anokogiriTuplePtr
.https://github.com/sparklemotion/nokogiri/blob/master/ext/nokogiri/xml_document.h#L18
In this case however,
node->doc
is not a document, but aXML_DOCUMENT_FRAG_NODE
, so actually it's anxmlNode
that stores a VALUE in_private
:This can also be seen because the
_private
pointer ofnode
andnode->doc
are both very similar and allocated in the memory area where Rubinius allocates the storage behind a VALUE.I have no idea why this doesn't also crash on MRI, but I suspect it's the conservative garbage collection that doesn't try to GC something inside rb_gc_mark that doesn't look like a valid heap pointer. That way it works as an implementation side effect and actually still is a bug in the implementation.
The text was updated successfully, but these errors were encountered: