ruby / ruby/zlib

Zlib.gzip sometimes errors out with Zlib::BufError if process has been forked

Open
#49 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
73
Forks
40
Avg merge
10h 32m
Merged PRs (30d)
2

Description

Ref: opal/opal#2463

The issue can't be reproduced reliably, the most reliable way is with the following code (you may need to launch it a couple of times) WARNING: it forks a lot of processes:

[user@localhost opal]# ruby _testzlib.rb 
_testzlib.rb:5:in `gzip': buffer error (Zlib::BufError)
	from _testzlib.rb:5:in `<main>'
[user@localhost opal]# _testzlib.rb:5:in `gzip': buffer error (Zlib::BufError)
	from _testzlib.rb:5:in `<main>'

[user@localhost opal]# 
[user@localhost opal]# cat _testzlib.rb 
require 'zlib'

10.times { fork }

Zlib.gzip("sdfasfasdfasdfasdasdfadfasdf" * 10000)
[user@localhost opal]# 

The issue has been seen on opal's CI since Ruby 2.6 until 3.1.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer in _testzlib.rb: it forks ten processes, then calls Zlib.gzip with a large string. Run it repeatedly and review the reference to opal/opal#2463 and the Ruby 2.6–3.1 CI reports. Done means the forked-process scenario no longer raises Zlib::BufError.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ruby
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.