ankane / or-tools-ruby

Operations research tools for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Have you seen segfaults ever?

joegaudet opened this issue · comments

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.

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

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.

Hey @ankane

  • ruby 2.7.2
  • or-tools (0.9.0)
  • OS X ventura

Thanks, and which solver is it?

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: ruby-rice/rice#170

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).

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

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 #ORTools::Assignment:0x00007fea14954c68 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

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

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