ankane / or-tools-ruby

Operations research tools for Ruby
Apache License 2.0
171 stars 20 forks source link

Question: Have you seen segfaults ever? #44

Open joegaudet opened 1 year ago

joegaudet commented 1 year ago

Been porting my python solver implementation over, and have been encountering segfaults on occasion?

Trying to figure out if it's my implementation or no.

joegaudet commented 1 year ago

Specifically seems to be occurring when I sum arrays of variables to apply constraints.

ankane commented 1 year ago

Hey @joegaudet, thanks for reporting. The library shouldn't segfault with any implementation, so seems like a bug.

What OS and Ruby version are you on? There have been some segfaults on CI with Ruby 3.2 and Ubuntu 22.04, but I haven't been able to reproduce locally with the same environment to figure out the cause.

joegaudet commented 1 year ago

Hey @ankane

ankane commented 1 year ago

Thanks, and which solver is it?

joegaudet commented 1 year ago

ORTools::CpModel

On Wed, Mar 8, 2023 at 4:28 PM Andrew Kane @.***> wrote:

Thanks, and which solver is it?

— Reply to this email directly, view it on GitHub https://github.com/ankane/or-tools-ruby/issues/44#issuecomment-1461078399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA6IB43DUGF67ZP6Q57ITTW3EPYFANCNFSM6AAAAAAVTJOUKE . You are receiving this because you were mentioned.Message ID: @.***>

ankane commented 1 year ago

Hey @joegaudet, can you try uninstalling the gem and using Rice from GitHub to see if that fixes it?

gem uninstall --all or-tools
bundle add rice --github jasonroelofs/rice
bundle install

It seems to make a difference on CI.

Ref: https://github.com/jasonroelofs/rice/pull/170

ankane commented 1 year ago

Hmm, using Rice from GitHub seems to make a difference on CI, even with the commit that matches the latest release, so don't think it's related to the referenced issue (also, doesn't appear to use that code path).

ankane commented 1 year ago

Quick update: Found a memory issue / the likely culprit - still working on how to solve.

khadzhinov commented 4 months ago

Hello, I got segmentation error on Ruby 2.6.5, Mac OS Ventura 13.6.1, and or-tools gem 0.3.4. I get this error, when I try to solve Time Window Constraints problem with wrong data (i.e. intersecting time windows), I found that on this ruby version and gem version the line solution = routing.solve(first_solution_strategy: :path_cheapest_arc) always returns me # object and then the line plan_output += "#{manager.index_to_node(index)} Time(#{solution.min(time_var)},#{solution.max(time_var)}) -> " raises segfault error, but when I try do the same on Ruby 3.0 and gem or-tools 0.11.1 routing.solve(first_solution_strategy: :path_cheapest_arc) returns me nil, and I can check that solution was not found and don't go further. So how can I get nil from that line, using 0.3.4 version of this gem, may be I need to change something, can you help me?

[BUG] Segmentation fault at 0x0000000000000010
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0110 p:---- s:0783 e:000782 CFUNC  :min
ankane commented 4 months ago

Hi @khadzhinov, only the latest version is supported (which requires Ruby 3+).

Also, I'm no longer seeing the memory issue, fwiw.