Replies: 1 comment 2 replies
-
Hi @kmewhort |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm seeing an odd process hangs and
malloc
errors in a call toYAML.dump
, only in Ruby 3.2.X.So far, I'm only able to reproduce it through use of the
vcr
library -- so I've posted the bug there (vcr/vcr#964) -- but it seems like a deeper issue so hoping someone here might have further insight.These are the details (reposted from that
vcr
bug report):Using:
As of upgrading to Ruby 3.2.0, when recording a cassette that gets back a long binary response, the serialization usually completely hangs, and I sometimes gives a malloc error. I can consistently reproduce with the following trivial example:
The malloc error that comes up about 1 in 10 runs is:
The error occurs at the
::YAML.dump(hash)
inlib/vcr/cassette/serializers/yaml.rb:37
. You can reproduce by putting a breakpoint there and trying that line.Interestingly, if at this point in the code, you try serializing just the string but not the full hash, there's a serialization error, but no hang:
If you clobber the string (
hash['http_interactions'][0]['response']['body']['string'] = ""
) it'll pass completely. So the issue arises only in a combination of the invalid, long response string with the rest of the request hash.Going back to this invalid string...you can get the error with just one character:
Which is this character:
So definitely not valid UTF-8, but this the error I would expect:
Two different errors from what looks from the outside be the exact same character. This means there's something funky about that String instantiation itself. I thus suspect the memory in the string has actually been de-allocated or corrupted, especially given the malloc error that comes up sometimes.
I'm not sure if I should raise this issue to
ruby
itself, but I can only reproduce through VCR...if it's a ruby issue, anyone have insight on how VCR is acting on the String to get into this state (so we can distill it to a simpler repro forruby
)?Beta Was this translation helpful? Give feedback.
All reactions