Skip to content

Occasional Errno::EBADF via Sidekiq. Thread-safety issues? #101

@henrik

Description

@henrik

We've seen an Errno::EBADF: Bad file descriptor error from this lib twice in the past 3 weeks.

It runs in Sidekiq jobs (meaning it's multi-threaded). My suspicion is that it's a thread-safety issue where if two requests overlap, they might both try to close the same connection/socket causing this error.

I'm not close to expert at threading or networking so this is a complete guess.

Backtrace:

/opt/ruby/lib/ruby/3.2.0/openssl/ssl.rb:387 :in 'close'
/opt/ruby/lib/ruby/3.2.0/openssl/ssl.rb:387 :in 'sysclose'
/opt/ruby/lib/ruby/3.2.0/openssl/buffering.rb:485 in 'close'
/opt/ruby/lib/ruby/3.2.0/net/http.rb:1357 in 'rescue in connect'
/opt/ruby/lib/ruby/3.2.0/net/http.rb:1253 in 'connect'
/opt/ruby/lib/ruby/3.2.0/net/http.rb:1248 in 'do_start'
/opt/ruby/lib/ruby/3.2.0/net/http.rb:1237 :in 'start'
[GEM_ROOT]/gems/customerio-5.0.0/lib/customerio/base_client.rb:62:in 'execute'
[GEM_ROOT]/gems/customerio-5.0.0/lib/customerio/base_client.rb:28:in 'request'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions