Closed archonic closed 5 years ago
Interestingly, I also use pycall in sidekiq context (to call GDAL). I do not observe segfaults and I don't need to restart sidekiq. I do observe other pycall-related errors, but I can rely on sidekiq's retry mechanism to handle them.
EDIT: I was to quick to comment. Sidekiq worked fine with pycall 1.0.3. With the latest version (1.2.1) it also segfaults for me.
@kammerer Good to know! I'll try out 1.0.3 today and see if I see the same thing. If that's the case it should be pretty easy to see what the breaking change was.
Sadly I still get a segmentation fault with 1.0.3, and it turned out the first time I was trying this out, I was running 1.0.0. Seems this particular bug has always been here.
@kammerer Do you think I could see some of your code that wraps pycall in sidekiq if you consistently avoid segfaults? Are you doing any manual garbage collection or performing pycall methods in a block that spawns a new thread?
@archonic I am afraid the code is closed-source, I cannot share too much of it. But no, I am not doing anything special like manual garbage collection. I use a helper module to include pycall into PORO classes, but I don't suppose it makes any difference:
# lib/pygdal/base.rb
require 'pycall'
require 'pycall/import'
module PyGdal::Base
def self.included(base)
base.include PyCall::Import
end
def self.extended(base)
base.extend PyCall::Import
end
# ...
end
I missed this issue. I'm sorry for late response.
@archonic Could you show the C backtrace and the code to reproduce this problem? I want to investigate this after RubyKaigi 2019.
I've been splitting my replies between this and https://github.com/mrkn/pycall.rb/issues/49, sorry about that.
I've reproduced the issue on 1.0.0, 1.0.3, but I just checked 1.2.1 and it's not segment faulting 😄🎉. I must not have rebuilt my docker images last time I tried checking 1.2.1. Sorry again! And thanks for the great gem.
I believe this may be different from other segmentation issues so I'm opening a new issue. I made a ruby wrapper gem for a python library called html-tree-diff. I can perform as many diffs as I want from the console, and I can preform one sidekiq job (per-restart). On the second sidekiq job, I consistently get a segmentation fault.
Here's the console output:
And here is the first part of segmentation fault trace. It was too large to paste in its entirety.
My thoughts right now is that within the console context, the Ruby GC isn't attempting to deallocate the python object, whereas that is happening within the Sidekiq context, which is causing the segmentation fault in the same way as #71.