Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault with "minizinc" command #202

Closed
scand1sk opened this issue Feb 18, 2018 · 9 comments
Closed

Segmentation fault with "minizinc" command #202

scand1sk opened this issue Feb 18, 2018 · 9 comments
Labels

Comments

@scand1sk
Copy link

scand1sk commented Feb 18, 2018

I run MiniZinc 2.1.7 on Debian Unstable. I got the following error with mzn-* commands (whichever solver is run):

*** Mercury runtime: caught segmentation violation ***
cause: address not mapped to object
address involved: 0xffffffffff600000
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler
Segmentation fault

Note that mzn2fzn and fzn-* commands work well. I could design a workaround by rewritting mzn-gecode as a quick & dirty bash script, but it would be better if it worked as expected :)

@Dekker1
Copy link
Member

Dekker1 commented Feb 18, 2018

I'm afraid that the error by itself won't give us any clues unless you post the model (instance) that you are compiling.

Note that minizinc is merely a driver for FlatZinc solvers, it uses the installed version of mzn2fzn, that stems from MiniZinc 1.*. In the new version of the compiler we have an replacement: mzn-fzn; however this binary is not yet widely used. mzn-gecode is already a shell script that, in the gecode repository, falls back on mzn-fzn.

@scand1sk
Copy link
Author

scand1sk commented Feb 18, 2018

I do not need any model instance. The segfault happens even with no arguments or simply --help. I see that mzn-gecode uses the binary minizinc to launch the solver, and the minizinc binary fails. I get the same error by running ./minizinc with no arguments.

My workaround shell script succeeds by avoiding to call the minizinc binary.

Note that the errors happens both with the Debian packaged release of MiniZinc (although mzn-gecode is missing in the Debian package, the minizinc command fails as well) and the download available on the MiniZinc website.

The issue is very probably linked to the specific environment I work in (although Debian unstable is a fairly popular distribution), but I am not familiar enough with mercury or C++ to investigate this by myself.

@guidotack
Copy link
Member

guidotack commented Feb 18, 2018 via email

@Dekker1 Dekker1 added the bundle label Feb 19, 2018
@HelgeS
Copy link

HelgeS commented Feb 21, 2018

Can confirm the same error with minizinc-ide v2.1.7-1 under Arch Linux. Although I'm unsure which package update caused the error.

Running minizinc -Ggecode model.fzn causes the error, fzn-gecode model.fzn works fine.

@edouardklein
Copy link

I, too, was bitten by this bug, just before the deadline of the coursera course... I wrote a shell script wrapper as a workaround:

#!/usr/bin/env sh
MZN_FILE=$1
DATA_FILE=$2

mzn2fzn $MZN_FILE $DATA_FILE && fzn-gecode -a $(basename $MZN_FILE .mzn).fzn | sed -E 's/array1d\([0-9]+\.\.[0-9]+, //' | sed -E 's/\)//' 

Would it be possible to compile minizinc as a statically linked executable ?

@Dekker1
Copy link
Member

Dekker1 commented Mar 11, 2018

@edouardklein It's a shame you ran into the same problem when you where on a deadline. As said before, we intend to replace the minizinc executable in the next release. The easiest solution is still to replace minizinc with mzn-fzn

Note that your script will actually not use any output statement from the provided MiniZinc model. Instead of using sed you would have to use solns2out, a tool provided which will use the output model.

@guidotack
Copy link
Member

guidotack commented Mar 12, 2018 via email

@scand1sk
Copy link
Author

scand1sk commented Mar 12, 2018 via email

@guidotack
Copy link
Member

The minizinc command in release 2.2.0 is a complete rewrite that hopefully fixes these problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants