Comments (35)
If you can help me that would be great. Can you try running with the class_cache turned off? What other options are you using?
from ox.
Sure, would be happy to try that out. Unfortunately I can't find any documentation on how to turn class_cache off. Additionally, I'm not running with any options. Just passing in an IO object and a vanilla Sax Doc.
from ox.
Wrong gem. Ox does not have the class_cache option, only Oj. Vanilla Sax is enough for me to get started though.
from ox.
I checked in a fix. Can you give it a whirl on your system. Of by one on buffer size.
from ox.
Trying it out now. I'll give it a day or so and report back! Thanks for the prompt response, it is seriously awesome to see a gem maintained so well.
from ox.
Thanks.
from ox.
I've gotten two crashes with the same .crash report. They seem to be happening less frequently, but happen nonetheless. I used revision: bb30dbe8db25b9bf34d393a0296f4e10f3c2cb87
.
from ox.
Can you give me a file to test with?
from ox.
The Sax document file I presume?
from ox.
The XML file that triggers the crash.
from ox.
There is no XML file that triggers the crash. The crash occurs during ruby garbage collection, often times well after XML parsing has completed.
from ox.
Can you provide a copy of the XML that is parsed before the crash? I'd like to try and recreate the problem.
from ox.
This is within a Rails app; there may be 100 XML documents parsed before it faults. That said I'll see if I can get it to occur by hitting only one document so you can test against it.
from ox.
Thanks.
from ox.
I've been trying to isolate this with a single XML document but not finding much luck. You know, I'm wondering: If I raise an exception from within a SAX call back like #start_element or #end_element, and that's not caught until we are well into the Rails stack, would that cause the memory allocation issue?
from ox.
In fact, I just ran a little test, and indeed that seems to be the cause of this. When I don't raise from within the callbacks, I don't get any segfaults. I'm not having this problem with nokogiri, is this something that can be fixed?
from ox.
Thank you for digging into the problem. That gives me something to work with. I'll see what I can do over the weekend if not sooner.
from ox.
I'm not having much success reproducing the problem. Do you have a test you can share?
from ox.
Were you able to find a file to share for testing?
from ox.
Hey, sorry sorry, I've gotten tied up with some other work at the moment, should hopefully have a solid test case for you soon. Apologies for the delay
from ox.
No worries. Just checking up on outstanding issues.
from ox.
Sorry for the delay, I got a test case for you finally. You can clone it here.
from ox.
Thats great. Thanks. I'll give it a try tonight.
from ox.
What platform are you running on? OS X? Linux?
from ox.
I added a print statement to the Ox initializer function and it was never called. Are you sure the test you have is a valid test?
from ox.
Yep, OSX 10.6. I just tried on a different machine running 10.7 and got the segfault. Are you visiting http://localhost:3000/parse/
once the rails server is running? I see it raising from within end_element
from ox.
I missed the /parse. I get an error in soap.rb in end_element. Is that expected?
from ox.
Eventually a crash. Cool, I can reproduce it here.
from ox.
Got it fixed. I want to add some stack use optimizations before releasing though. A couple of days at most.
from ox.
You made it very easy to find. Thank you for the help.
from ox.
Cool, glad I could help. I see the commits, but could you share a bit about what was going on that was causing it not to be exception safe?
from ox.
I had not wrapped the parse call with a rb_protect(). With that in place I can get the exception back, cleanup, and then raise the exception. An oversight on my part.
from ox.
Good to close?
from ox.
I think so. A couple days now with no hint of a problem. Thanks again, awesome to see this well maintained.
from ox.
I do my best. Thanks for the feedback and the help identifying the problem.
from ox.
Related Issues (20)
- Various thoughts HOT 10
- Use "interned" (frozen and deduplicated) Strings in Ruby 3.0+ to minimize object allocations. HOT 3
- Become `Ractor`-safe to allow usage in non-main `Ractor`. HOT 1
- Bundle install failing HOT 7
- Parse error for comments containing special characters inside a DOCTYPE declaration HOT 1
- Single carriage return is not converted to line feed HOT 16
- Easy way to get backtrace information from the C extension? HOT 18
- Process XML with instructions longer than 1024 characters. HOT 9
- Ox 2.14.7 causes segfault HOT 14
- RESX XML parsing - support for xml:space="preserve" HOT 3
- Preserve newlines in attributes and bodies when parsing. HOT 2
- [BUG] Bus Error (crashes ruby when using more than 16458 characters in a field) HOT 5
- Request to include a new mode to load which prepends xml attributes with a given string or a default HOT 1
- Ox.load result changes after parsing specific xml. HOT 2
- Sax parser segfault in v2.14.7+ HOT 4
- `StringIO` in `Ox::Builder` HOT 2
- Sax parsing with default encoding set to UTF-8 breaks Ox::Sax#text HOT 2
- OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE is not shareable across ractors HOT 1
- Issue with gems on M1 that depends on ox HOT 3
- test/tests.rb fails with ruby3.2.0preview3 and onwards HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ox.