Comments (19)
from trealla.
Test cases are from here:
http://www.rubycap.ch/gist/bench.tar.gz
from trealla.
Scryer Prolog can also not run the benchmark suite.
But the bug is more subtle, only one solution:
$ ../target/release/scryer-prolog -v
"v0.9.0-175-g6b8e6204"
$ ../target/release/scryer-prolog
?- [tictac].
true.
?- best(["x-o", "o-x", "-x-"],x,Y).
Y = ["x-o","o-x","-xx"].
But then SWI-Prolog gives me 4 solutions:
/* SWI-Prolog (threaded, 64 bits, version 8.5.14) */
?- set_prolog_flag(double_quotes, chars).
true.
?- best(["x-o", "o-x", "-x-"],x,Y).
Y = [[x, x, o], [o, -, x], [-, x, -]] ;
Y = [[x, -, o], [o, x, x], [-, x, -]] ;
Y = [[x, -, o], [o, -, x], [x, x, -]] ;
Y = [[x, -, o], [o, -, x], [-, x, x]].
And Trealla has also no problem:
$ ../tpl -v
Trealla Prolog (c) Infradig 2020-2022, v2.1.11
$ ../tpl
?- ['tictac.p'].
true.
?- best(["x-o", "o-x", "-x-"],x,Y).
Y = ["xxo","o-x","-x-"]
; Y = ["x-o","oxx","-x-"]
; Y = ["x-o","o-x","xx-"]
; Y = ["x-o","o-x","-xx"].
from trealla.
from trealla.
from trealla.
from trealla.
I am running on WSL. Still get the Segmentation Fault.
Now using v2.1.12, seems my machine is a little faster than yours:
$ ../tpl -v
Trealla Prolog (c) Infradig 2020-2022, v2.1.12
$ ../tpl -g suite,nl,suite -f suite.p
nrev Time elapsed 0.731s
crypt Time elapsed 0.596s
deriv Time elapsed 0.713s
poly Time elapsed 0.606s
sortq Time elapsed 0.82s
tictac Time elapsed 0.791s
queens Time elapsed 0.762s
query Time elapsed 1.55s
mtak Segmentation fault
mtak is some Tarai function:
https://en.wikipedia.org/wiki/Tak_%28function%29
from trealla.
On Windows 10 WSL 2, you can also provoke
the error like this:
$ lscpu
[...]
Model name: AMD Ryzen 5 4500U with Radeon Graphics
[...]
$ uname -r
5.10.102.1-microsoft-standard-WSL2
$ uname -m
x86_64
$ ../tpl
?- ['mtak.p'].
true.
?- mtak.
true.
?- time((between(1,31,_), mtak, fail; true)).
realloc(): invalid next size
Aborted
Maybe the failure driven loop and/or time/1
,
together with mtak/0
is the problem?
from trealla.
from trealla.
The problem seems to be already in unwind_trail,
using valgrind I get:
$ valgrind ../tpl
==446== Memcheck, a memory error detector
==446== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==446== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==446== Command: ../tpl
==446==
?- ['mtak.p'].
true.
?- mtak.
true.
?- time((between(1,31,_), mtak, fail; true)).
==446== Invalid read of size 2
==446== at 0x184005: unwind_trail (in /home/rburs/trealla/tpl)
==446== by 0x184BEB: retry_choice (in /home/rburs/trealla/tpl)
==446== by 0x187A05: start (in /home/rburs/trealla/tpl)
==446== by 0x14B0D0: run (in /home/rburs/trealla/tpl)
==446== by 0x182934: pl_eval (in /home/rburs/trealla/tpl)
==446== by 0x113CEB: main (in /home/rburs/trealla/tpl)
==446== Address 0x6c2b772 is 8,706 bytes inside an unallocated block of size 722,752 in arena "client"
==446==
==446== Invalid write of size 1
==446== at 0x18400E: unwind_trail (in /home/rburs/trealla/tpl)
==446== by 0x184BEB: retry_choice (in /home/rburs/trealla/tpl)
==446== by 0x187A05: start (in /home/rburs/trealla/tpl)
==446== by 0x14B0D0: run (in /home/rburs/trealla/tpl)
==446== by 0x182934: pl_eval (in /home/rburs/trealla/tpl)
==446== by 0x113CEB: main (in /home/rburs/trealla/tpl)
==446== Address 0x6c2b770 is 8,704 bytes inside an unallocated block of size 722,752 in arena "client"
==446==
==446== Invalid write of size 8
==446== at 0x184015: unwind_trail (in /home/rburs/trealla/tpl)
==446== by 0x184BEB: retry_choice (in /home/rburs/trealla/tpl)
==446== by 0x187A05: start (in /home/rburs/trealla/tpl)
==446== by 0x14B0D0: run (in /home/rburs/trealla/tpl)
==446== by 0x182934: pl_eval (in /home/rburs/trealla/tpl)
==446== by 0x113CEB: main (in /home/rburs/trealla/tpl)
==446== Address 0x6c2b778 is 8,712 bytes inside an unallocated block of size 722,752 in arena "client"
==446==
==446== Invalid read of size 1
==446== at 0x18401D: unwind_trail (in /home/rburs/trealla/tpl)
==446== by 0x184BEB: retry_choice (in /home/rburs/trealla/tpl)
==446== by 0x187A05: start (in /home/rburs/trealla/tpl)
==446== by 0x14B0D0: run (in /home/rburs/trealla/tpl)
==446== by 0x182934: pl_eval (in /home/rburs/trealla/tpl)
==446== by 0x113CEB: main (in /home/rburs/trealla/tpl)
==446== Address 0x6c2b78c is 8,732 bytes inside an unallocated block of size 722,752 in arena "client"
==446==
==446== Invalid write of size 4
==446== at 0x184021: unwind_trail (in /home/rburs/trealla/tpl)
==446== by 0x184BEB: retry_choice (in /home/rburs/trealla/tpl)
==446== by 0x187A05: start (in /home/rburs/trealla/tpl)
==446== by 0x14B0D0: run (in /home/rburs/trealla/tpl)
==446== by 0x182934: pl_eval (in /home/rburs/trealla/tpl)
==446== by 0x113CEB: main (in /home/rburs/trealla/tpl)
==446== Address 0x6c2b780 is 8,720 bytes inside an unallocated block of size 722,752 in arena "client"
==446==
valgrind: m_mallocfree.c:303 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 722688, hi = 0.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata. If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away. Please try that before reporting this as a bug.
from trealla.
I am using gcc compiler to build Trealla. Should I use some
other compiler? Maybe some alignment problem, in some record,
combined with a size calculation problem.
from trealla.
from trealla.
from trealla.
I was using Ubuntu 22.x on WSL 2, just installed yesterday.
The switch to Ubuntu 22.x was the reason I did regression testing.
Maybe there is a dependency there. Currently trying whether
it runs Ubuntu 22.x in some cloud. Please be patient.
Maybe Ubuntu 22.x has a more hardened malloc library?
from trealla.
Yeah same problem on Unix, not WSL 2 specific (screenshot):
I get the same segmentation fault (screenshot):
from trealla.
from trealla.
from trealla.
I did a 100% clean install of trealla, fresh clone from GitHub and fresh make.
The make had no parameters. The error happens here, this is from the cloud:
Thread 1: status = VgTs_Runnable (lwpid 293845)
==293845== at 0x484DCD3: realloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==293845== by 0x1382D2: alloc_grow (in /home/ruby/trealla/tpl)
==293845== by 0x1849E2: add_trail (in /home/ruby/trealla/tpl)
==293845== by 0x18697B: set_var (in /home/ruby/trealla/tpl)
==293845== by 0x1AB36E: unify_internal.part.0 (in /home/ruby/trealla/tpl)
==293845== by 0x1ACFA9: unify (in /home/ruby/trealla/tpl)
==293845== by 0x15B2E5: fn_between_3 (in /home/ruby/trealla/tpl)
==293845== by 0x18811D: start (in /home/ruby/trealla/tpl)
==293845== by 0x14B0D0: run (in /home/ruby/trealla/tpl)
==293845== by 0x182934: pl_eval (in /home/ruby/trealla/tpl)
==293845== by 0x113CEB: main (in /home/ruby/trealla/tpl)
And valgrind shows me a new error before the abort happens:
==293845== Conditional jump or move depends on uninitialised value(s)
==293845== at 0x18400C: unwind_trail (in /home/ruby/trealla/tpl)
==293845== by 0x184BEB: retry_choice (in /home/ruby/trealla/tpl)
==293845== by 0x187A05: start (in /home/ruby/trealla/tpl)
==293845== by 0x14B0D0: run (in /home/ruby/trealla/tpl)
==293845== by 0x182934: pl_eval (in /home/ruby/trealla/tpl)
==293845== by 0x113CEB: main (in /home/ruby/trealla/tpl)
==293845==
from trealla.
I could now run the benchmark with version 2.1.17.
Closing this ticket now.
from trealla.
Related Issues (20)
- Segmentation Dump with NOFFI=1 NOSSL=1 NOTHREADS=1 ISOCLINE=1 Enabled HOT 1
- arg/3 + string weirdness HOT 2
- freeze/2 not playing well with negation HOT 6
- Module visibility for attributes incorrect? HOT 2
- Callligraphic script not unparsed like it is parsed?
- matrix: mat_lup_det/2 segfault HOT 4
- Apropos reading/writing. Trying to read from a named pipe: HOT 4
- Loading nonexistent shared lib should be an error HOT 10
- GSL: Error handling HOT 4
- GSL: matrix no-size (0x0) segfault HOT 4
- GSL: Info+Question HOT 14
- Support CLP(B) HOT 10
- Superflous parenthesis for fy mode HOT 3
- GSL: wrong sized matrix segfault
- GSL: library/gsl.pl hard-coded size
- GSL: result inoperative HOT 12
- pl_yield_at can cause some undesirable side effects HOT 10
- getting answers that are just a variable HOT 7
- [] not an atom that can be used as an operator HOT 10
- GSL: Bugs HOT 23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trealla.