lucasart / Demolito

UCI Chess Engine
GNU General Public License v3.0
45 stars 9 forks source link

Segfaults #64

Closed archtux closed 8 years ago

archtux commented 8 years ago

Hi Lucas, I've compiled many commits of demolito in Linux 64 bits and I get nearly all games a segfault. I've tried with GCC and Clang. I used the make.sh script and also tried to compile on my own, always same result. On 32 bits hardware no segfaults. Does this engine only run on 32 bits?

lucasart commented 8 years ago

Can you show me some a minimal path to reproduce the problem ? (ie. what you type to compile, then what you type when you start the engine, in terms of UCI commands, until the segfault).

archtux commented 8 years ago

Hello Lucas,

When I compile demolito on a 32 bit Linux laptop there are no crashes. When I compile demolito in my 64 bits Linux desktop almost every game it crashes. I run the engine in Cutechess GUI. My computer is a quadcore Intel core i5(has SSE4.2). The release version is compiled with : g++ .cc -std=c++11 -DNDEBUG -Wfatal-errors -Wall -Wextra -Wshadow -lpthread -flto -march=native -O3 -o demolito I compiled the debug version in source directory: g++ .cc -g -std=c++11 -lpthread -o demolito The debug version crashes in line 537 from position.cc.(assert(bb::count(pieces(pos, c, KING)) == 1);) Here is a coredump. See the backtrace in frame #4

[antonio@manjaro coredump]$ coredumpctl gdb 15062 PID: 15062 (demolito) UID: 1000 (antonio) GID: 1000 (antonio) Signal: 6 (ABRT) Timestamp: Sat 2016-11-12 16:41:04 CET (2h 4min ago) Command Line: ./demolito Executable: /mnt/sda4/ARCH/CHESS-ENGINES/DEMOLITO-GIT-243/DEBUG/src/Demolito/src/demolito Control Group: / Slice: -.slice Boot ID: 89e7c46f7f944ba5851c0eb99508ca7a Machine ID: 77f35eb0e2dc49c3af0a8418f3437eb4 Hostname: manjaro Coredump: /var/lib/systemd/coredump/core.demolito.1000.89e7c46f7f944ba5851c0eb99508ca7a.15062.1478965264000000000000.lz4 Message: Process 15062 (demolito) of user 1000 dumped core.

Stack trace of thread 19269:

0 0x00007f50e59fd04f raise (libc.so.6)

1 0x00007f50e59fe47a abort (libc.so.6)

2 0x00007f50e59f5ea7 __assert_fail_base (libc.so.6)

3 0x00007f50e59f5f52 __assert_fail (libc.so.6)

4 0x0000000000409bf1 _Z11king_squareRK8Position5Color (demolito)

5 0x0000000000407e1c _ZN8Position6finishEv (demolito)

6 0x0000000000408c68 _ZN8Position3setERKS_4Move (demolito)

7 0x000000000040dc3a

_ZN6search7recurseILb1EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

8 0x000000000040bf48

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

9 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

10 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

11 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

12 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

13 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

14 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

15 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

16 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

17 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

18 0x000000000040aac6 _ZN6search8aspirateERK8PositioniRSt6vectorItSaItEEi

(demolito)

19 0x000000000040ad0a

_ZN6search7iterateERK8PositionRKNS_6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEi (demolito)

20 0x000000000041216f

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEE9_M_invokeIJLm0ELm1ELm2ELm3ELm4EEEEvSt12_Index_tupleIJXspT_EEE (demolito)

21 0x0000000000411f63

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEEclEv (demolito)

22 0x0000000000411eba

_ZNSt6thread11_State_implISt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS3_ESJ_IS7_ESJ_ISB_ESJ_ISF_EiEEE6_M_runEv (demolito)

23 0x00007f50e633e31f execute_native_thread_routine (libstdc++.so.6)

24 0x00007f50e6612454 start_thread (libpthread.so.0)

25 0x00007f50e5ab27df __clone (libc.so.6)

Stack trace of thread 19272:

0 0x00000000004124e8 _ZN6search8Selector6selectERK8PositionRi (demolito)

1 0x000000000040c0a7

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

2 0x000000000040bf8b

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

3 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

4 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

5 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

6 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

7 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

8 0x000000000040c4aa

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

9 0x000000000040c4aa

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

10 0x000000000040aac6 _ZN6search8aspirateERK8PositioniRSt6vectorItSaItEEi

(demolito)

11 0x000000000040ad0a

_ZN6search7iterateERK8PositionRKNS_6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEi (demolito)

12 0x000000000041216f

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEE9_M_invokeIJLm0ELm1ELm2ELm3ELm4EEEEvSt12_Index_tupleIJXspT_EEE (demolito)

13 0x0000000000411f63

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEEclEv (demolito)

14 0x0000000000411eba

_ZNSt6thread11_State_implISt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS3_ESJ_IS7_ESJ_ISB_ESJ_ISF_EiEEE6_M_runEv (demolito)

15 0x00007f50e633e31f execute_native_thread_routine (libstdc++.so.6)

16 0x00007f50e6612454 start_thread (libpthread.so.0)

17 0x00007f50e5ab27df __clone (libc.so.6)

Stack trace of thread 19271:

0 0x00000000004036a4 _ZN2bb3lsbEm (demolito)

1 0x000000000040373f _ZN2bb7pop_lsbERm (demolito)

2 0x000000000041af05 _ZN7zobrist4keysE5Color5Piecem (demolito)

3 0x0000000000409168 _Z8calc_keyRK8Position (demolito)

4 0x000000000040863c _ZNK8Position3keyEv (demolito)

5 0x000000000040d752

_ZN6search7recurseILb1EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

6 0x000000000040c3bc

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

7 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

8 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

9 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

10 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

11 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

12 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

13 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

14 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

15 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

16 0x000000000040aac6 _ZN6search8aspirateERK8PositioniRSt6vectorItSaItEEi

(demolito)

17 0x000000000040ad0a

_ZN6search7iterateERK8PositionRKNS_6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEi (demolito)

18 0x000000000041216f

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEE9_M_invokeIJLm0ELm1ELm2ELm3ELm4EEEEvSt12_Index_tupleIJXspT_EEE (demolito)

19 0x0000000000411f63

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEEclEv (demolito)

20 0x0000000000411eba

_ZNSt6thread11_State_implISt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS3_ESJ_IS7_ESJ_ISB_ESJ_ISF_EiEEE6_M_runEv (demolito)

21 0x00007f50e633e31f execute_native_thread_routine (libstdc++.so.6)

22 0x00007f50e6612454 start_thread (libpthread.so.0)

23 0x00007f50e5ab27df __clone (libc.so.6)

Stack trace of thread 19270:

0 0x0000000000406460 _ZN2bb8battacksE6Squarem (demolito)

1 0x0000000000409da3 _Z12attackers_toRK8Position6Squarem (demolito)

2 0x0000000000407703 _ZNK4Move3seeERK8Position (demolito)

3 0x00000000004125f2 _ZN6search8Selector6selectERK8PositionRi (demolito)

4 0x000000000040c0a7

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

5 0x000000000040bf8b

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

6 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

7 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

8 0x000000000040c3ff

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

9 0x000000000040c44f

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

10 0x000000000040c2bd

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

11 0x000000000040c4aa

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

12 0x000000000040c4aa

_ZN6search7recurseILb0EEEiRK8PositioniiiiRSt6vectorItSaItEE (demolito)

13 0x000000000040aac6 _ZN6search8aspirateERK8PositioniRSt6vectorItSaItEEi

(demolito)

14 0x000000000040ad0a

_ZN6search7iterateERK8PositionRKNS_6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEi (demolito)

15 0x000000000041216f

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEE9_M_invokeIJLm0ELm1ELm2ELm3ELm4EEEEvSt12_Index_tupleIJXspT_EEE (demolito)

16 0x0000000000411f63

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS1_ESH_IS5_ESH_IS9_ESH_ISD_EiEEclEv (demolito)

17 0x0000000000411eba

_ZNSt6thread11_State_implISt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackERSt6vectorIiSaIiEEiESt17reference_wrapperIS3_ESJ_IS7_ESJ_ISB_ESJ_ISF_EiEEE6_M_runEv (demolito)

18 0x00007f50e633e31f execute_native_thread_routine (libstdc++.so.6)

19 0x00007f50e6612454 start_thread (libpthread.so.0)

20 0x00007f50e5ab27df __clone (libc.so.6)

Stack trace of thread 19268:

0 0x00007f50e661b79d __nanosleep (libpthread.so.0)

1 0x000000000040d193

_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE (demolito)

2 0x000000000040b156

_ZN6search8bestmoveERK8PositionRKNS_6LimitsERKN7zobrist9GameStackE (demolito)

3 0x000000000041a98d

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackEESt17reference_wrapperIS1_ESD_IS5_ESD_IS9_EEE9_M_invokeIJLm0ELm1ELm2EEEEvSt12_Index_tupleIJXspT_EEE (demolito)

4 0x000000000041a829

_ZNSt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackEESt17reference_wrapperIS1_ESD_IS5_ESD_IS9_EEEclEv (demolito)

5 0x000000000041a808

_ZNSt6thread11_State_implISt12_Bind_simpleIFPFvRK8PositionRKN6search6LimitsERKN7zobrist9GameStackEESt17reference_wrapperIS3_ESF_IS7_ESF_ISB_EEEE6_M_runEv (demolito)

6 0x00007f50e633e31f execute_native_thread_routine (libstdc++.so.6)

7 0x00007f50e6612454 start_thread (libpthread.so.0)

8 0x00007f50e5ab27df __clone (libc.so.6)

Stack trace of thread 15062:

0 0x00007f50e5aa54ed __read (libc.so.6)

1 0x00007f50e5a3da90 _IO_file_underflow@@GLIBC_2.2.5 (libc.so.6)

2 0x00007f50e5a3eb92 _IO_default_uflow (libc.so.6)

3 0x00007f50e5a39570 _IO_getc (libc.so.6)

4 0x00007f50e636fdad

_ZN9__gnu_cxx18stdio_sync_filebufIcSt11char_traitsIcEE8syncgetcEv (libstdc++.so.6)

5 0x00007f50e632c1c9 _ZNSt15basic_streambufIcSt11char_traitsIcEE5sgetcEv

(libstdc++.so.6)

6 0x000000000041928c _ZN3uci4loopEv (demolito)

7 0x00000000004068e2 main (demolito)

8 0x00007f50e59ea291 __libc_start_main (libc.so.6)

9 0x000000000040289a _start (demolito)

GNU gdb (GDB) 7.12 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /mnt/sda4/ARCH/CHESS-ENGINES/DEMOLITO-GIT-243/DEBUG/src/Demolito/src/demolito...done. [New LWP 19269] [New LWP 19272] [New LWP 19271] [New LWP 19270] [New LWP 19268] [New LWP 15062] [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Core was generated by `./demolito'. Program terminated with signal SIGABRT, Aborted.

0 0x00007f50e59fd04f in raise () from /usr/lib/libc.so.6

Current thread is 1 (Thread 0x7f50dd1c7700 (LWP 19269)) bt

0 0x00007f50e59fd04f in raise () from /usr/lib/libc.so.6

1 0x00007f50e59fe47a in abort () from /usr/lib/libc.so.6

2 0x00007f50e59f5ea7 in __assert_fail_base () from /usr/lib/libc.so.6

3 0x00007f50e59f5f52 in __assert_fail () from /usr/lib/libc.so.6

4 0x0000000000409bf1 in king_square (pos=..., c=BLACK) at position.cc:537

5 0x0000000000407e1c in Position::finish (this=0x7f50dd180b10) at

position.cc:73

6 0x0000000000408c68 in Position::set (this=0x7f50dd180b10, before=...,

m=...) at position.cc:308

7 0x000000000040dc3a in search::recurse (pos=..., ply=10, depth=0,

alpha=820, beta=821, pv=std::vector of length 0, capacity 0) at search.cc:197

8 0x000000000040bf48 in search::recurse (pos=..., ply=9, depth=4,

alpha=-821, beta=-820, pv=std::vector of length 0, capacity 0) at search.cc:152

9 0x000000000040c2bd in search::recurse (pos=..., ply=8, depth=5,

alpha=820, beta=821, pv=std::vector of length 0, capacity 0) at search.cc:219

10 0x000000000040c3ff in search::recurse (pos=..., ply=7, depth=6,

alpha=-821, beta=-820, pv=std::vector of length 0, capacity 0) at search.cc:229

11 0x000000000040c3ff in search::recurse (pos=..., ply=6, depth=8,

alpha=820, beta=821, pv=std::vector of length 0, capacity 0) at search.cc:229

12 0x000000000040c44f in search::recurse (pos=..., ply=5, depth=9,

alpha=-821, beta=-820, pv=std::vector of length 0, capacity 0) at search.cc:233

13 0x000000000040c3ff in search::recurse (pos=..., ply=4, depth=12,

alpha=820, beta=821, pv=std::vector of length 0, capacity 0) at search.cc:229

14 0x000000000040c2bd in search::recurse (pos=..., ply=3, depth=13,

alpha=-821, beta=-820, pv=std::vector of length 0, capacity 0) at search.cc:219

15 0x000000000040c3ff in search::recurse (pos=..., ply=2, depth=13,

alpha=820, beta=821, pv=std::vector of length 0, capacity 0) at search.cc:229

16 0x000000000040c44f in search::recurse (pos=..., ply=1, depth=14,

alpha=-821, beta=-820, pv=std::vector of length 0, capacity 137) at search.cc:233

17 0x000000000040c3ff in search::recurse (pos=..., ply=0, depth=17,

alpha=820, beta=884, pv=std::vector of length 138, capacity 138 = {...}) at search.cc:229

18 0x000000000040aac6 in search::aspirate (pos=..., depth=17,

pv=std::vector of length 138, capacity 138 = {...}, score=852) at search.cc:295

19 0x000000000040ad0a in search::iterate (pos=..., lim=...,

initialGameStack=..., iteration=std::vector of length 4, capacity 4 = {...}, threadId=0) at search.cc:344

20 0x000000000041216f in std::_Bind_simple<void

(*(std::reference_wrapper, std::reference_wrapper, std::reference_wrapper, std::reference_wrapper<std::vector<int, std::allocator > >, int))(Position const&, search::Limits const&, zobrist::GameStack const&, std::vector<int, std::allocator >&, int)>::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) (this=0x7f50d8008968) at /usr/include/c++/6.2.1/functional:1400

21 0x0000000000411f63 in std::_Bind_simple<void

(*(std::reference_wrapper, std::reference_wrapper, std::reference_wrapper, std::reference_wrapper<std::vector<int, std::allocator > >, int))(Position const&, search::Limits const&, zobrist::GameStack const&, std::vector<int, std::allocator >&, int)>::operator()() (this=0x7f50d8008968) at /usr/include/c++/6.2.1/functional:1389

22 0x0000000000411eba in std::thread::_State_impl<std::_Bind_simple<void

(*(std::reference_wrapper, std::reference_wrapper, std::reference_wrapper, std::reference_wrapper<std::vector<int, std::allocator > >, int))(Position const&, search::Limits const&, zobrist::GameStack const&, std::vector<int, std::allocator >&, int)> >::_M_run() (this=0x7f50d8008960) at /usr/include/c++/6.2.1/thread:196

23 0x00007f50e633e31f in std::execute_native_thread_routine

(__p=0x7f50d8008960) at /build/gcc-multilib/src/gcc/libstdc++-v3/src/c++11/thread.cc:83

24 0x00007f50e6612454 in start_thread () from /usr/lib/libpthread.so.0

25 0x00007f50e5ab27df in clone () from /usr/lib/libc.so.6

Kind regards,

               Antonio

On Thu, Nov 17, 2016 at 12:11 AM, lucasart notifications@github.com wrote:

Can you show me some a minimal path to reproduce the problem ? (ie. what you type to compile, then what you type when you start the engine, in terms of UCI commands, until the segfault).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lucasart/Demolito/issues/64#issuecomment-261103063, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdO1oDLFhjLUyUAW9a2RixltjLEwqdcks5q-42ogaJpZM4K0LHU .

lucasart commented 8 years ago

Thanks. Unfortunately "I run the engine with Cutechess GUI" is not enough to reproduce. Can you do the same experiment with cutechess-cli instead. Please run as follows:

./cutechess-cli \
  -each proto=uci tc=8+0.08 option.Hash=8 -variant 'fischerandom' \
  -engine cmd=$1 name="demolito" stderr=./errors \
  -engine cmd=$2 name="opponent" \
  -rounds 100 \
  -debug

where $1 is the path to a debug compile of demolito, and $2 any other engine that won't crash.

What I need is the last UCI communication (displayed on screen) and the file ./errors (stderr output including assert message will be captured there if any).

Thanks!

archtux commented 8 years ago

Hello Lucas,

Demolito didn't crash in 100 games with your command. I changed the hash size to 128 MB and then Demolito crashed. This is the last UCI communication before the crash.

157944 >Demolito-rev-247(0): position fen rnbnkbqr/pppppppp/8/8/8/8/PPPPPPPP/RNBNKBQR w HAha - 0 1 moves b1c3 e7e6 e2e4 f8e7 d1e3 a7a6 d2d3 b8c6 c1d2 h7h5 c3e2 g8h7 e1a1 e8h8 c1b1 c6b4 g2g3 b7b5 e2f4 g7g5 f4e2 c8b7 f1g2 f7f6 h2h4 d8f7 g3g4 a6a5 h4g5 h5h4 g5g6 h7g6 h1h4 f7e5 g1h2 g6g7 d1h1 157944 >Demolito-rev-247(0): isready 157945 <Demolito-rev-247(0): readyok 157945 >Demolito-rev-247(0): go wtime 3900 btime 4322 winc 80 binc 80 157953 <Demolito-rev-247(0): info depth 1 score cp -84 time 9 nodes 288 nps 32000 pv f6f5 157976 <Demolito-rev-247(0): info depth 2 score cp -172 time 31 nodes 2431 nps 78419 pv a8e8 h4h8 g8f7 157992 <Demolito-rev-247(0): info depth 3 score cp -173 time 48 nodes 3869 nps 80604 pv d7d5 d2b4 e7b4 158171 <Demolito-rev-247(0): bestmove d7d5 ponder d2b4 158171 >Cheese-18(1): position fen rnbnkbqr/pppppppp/8/8/8/8/PPPPPPPP/RNBNKBQR w HAha - 0 1 moves b1c3 e7e6 e2e4 f8e7 d1e3 a7a6 d2d3 b8c6 c1d2 h7h5 c3e2 g8h7 e1a1 e8h8 c1b1 c6b4 g2g3 b7b5 e2f4 g7g5 f4e2 c8b7 f1g2 f7f6 h2h4 d8f7 g3g4 a6a5 h4g5 h5h4 g5g6 h7g6 h1h4 f7e5 g1h2 g6g7 d1h1 d7d5 158171 >Cheese-18(1): isready 158171 <Cheese-18(1): readyok 158171 >Cheese-18(1): go wtime 3900 btime 4177 winc 80 binc 80 158175 <Cheese-18(1): info depth 1 seldepth 1 score cp 340 time 3 nodes 279 nps 70597 pv h4h8 g8f7 h2h5 g7g6 158177 <Cheese-18(1): info depth 2 seldepth 3 score cp 673 time 5 nodes 2432 nps 443957 pv h4h7 g7f7 h7f7 g8f7 d2b4 a5b4 e4d5 158178 <Cheese-18(1): info depth 3 seldepth 4 score cp 892 time 7 nodes 4776 nps 680051 pv h4h7 g7g5 h7e7 d5e4 158181 <Cheese-18(1): info depth 4 seldepth 5 score cp 857 time 9 nodes 8330 nps 884570 pv h4h7 g7g6 h7e7 e5f7 e7c7 158185 <Cheese-18(1): info depth 5 seldepth 7 score cp 857 time 13 nodes 13978 nps 1029914 pv h4h7 g7g6 h7e7 e5f7 e7c7 158196 <Cheese-18(1): info depth 6 seldepth 9 score cp 1021 time 24 nodes 51962 nps 2114167 pv h4h7 g7g6 h7e7 e5f7 e7f7 g8f7 h2c7 f7e8 c7b7 158202 <Cheese-18(1): info depth 7 seldepth 11 score cp 1021 time 30 nodes 73880 nps 2443444 pv h4h7 g7g6 h7e7 e5f7 e7f7 g8f7 h2c7 f7e8 c7b7 158214 <Cheese-18(1): info depth 8 seldepth 13 score cp 1021 time 42 nodes 123190 nps 2880155 pv h4h7 g7g6 h7e7 e5f7 e7f7 g8f7 h2c7 f7e8 c7b7 158253 <Cheese-18(1): info depth 9 seldepth 15 score cp 1008 time 81 nodes 275043 nps 3379114 pv h4h7 g7g6 h7e7 e5f7 e7f7 g8f7 h2c7 f7g8 d2b4 f8f7 158349 <Cheese-18(1): info depth 10 seldepth 17 score cp 987 time 177 nodes 642004 nps 3614521 pv h4h7 g7g6 h7e7 e5f7 e7f7 g8f7 h2c7 f7g8 c7b7 g6g7 b7b5 158349 <Cheese-18(1): bestmove h4h7 158349 >Demolito-rev-247(0): position fen rnbnkbqr/pppppppp/8/8/8/8/PPPPPPPP/RNBNKBQR w HAha - 0 1 moves b1c3 e7e6 e2e4 f8e7 d1e3 a7a6 d2d3 b8c6 c1d2 h7h5 c3e2 g8h7 e1a1 e8h8 c1b1 c6b4 g2g3 b7b5 e2f4 g7g5 f4e2 c8b7 f1g2 f7f6 h2h4 d8f7 g3g4 a6a5 h4g5 h5h4 g5g6 h7g6 h1h4 f7e5 g1h2 g6g7 d1h1 d7d5 h4h7 158349 >Demolito-rev-247(0): isready 158350 <Demolito-rev-247(0): readyok 158350 >Demolito-rev-247(0): go wtime 3802 btime 4177 winc 80 binc 80 Terminating process of engine Demolito-rev-247(0) 158545 >Cheese-18(1): isready 158545 <Cheese-18(1): readyok Elo difference: -inf +/- nan Finished match Finished game 10 (Cheese-18 vs Demolito-rev-247): 1-0 {Black disconnects} Score of Demolito-rev-247 vs Cheese-18: 0 - 10 - 0 [0.000] 10 158545 >Cheese-18(1): quit [antonio@manjaro src]$

And this is the message in errors.txt demolito: bitboard.cc:256: void bb::clear(bitboard_t&, Square): Assertion `test(b, s)' failed.

And this is the backtrace.

(gdb) bt

0 0x00007fa6bcff104f in raise () from /usr/lib/libc.so.6

1 0x00007fa6bcff247a in abort () from /usr/lib/libc.so.6

2 0x00007fa6bcfe9ea7 in __assert_fail_base () from /usr/lib/libc.so.6

3 0x00007fa6bcfe9f52 in __assert_fail () from /usr/lib/libc.so.6

4 0x0000000000403594 in bb::clear (b=@0x7fa6affbcbe0: 6918760558007160832,

s=F2) at bitboard.cc:256

5 0x0000000000407b8d in Position::clear (this=0x7fa6affbcbd8, c=BLACK,

p=PAWN, s=F2) at position.cc:38

6 0x000000000040898b in Position::set (this=0x7fa6affbcbd8, before=...,

m=...) at position.cc:264

7 0x0000000000419881 in uci::Info::update (this=0x715820 uci::ui,

pos=..., depth=1, score=-1030, nodes=2878, pv=std::vector of length 138, capacity 138 = {...}, partial=false) at uci.cc:229

8 0x000000000040abca in search::iterate (pos=..., lim=...,

initialGameStack=..., iteration=std::vector of length 1, capacity 1 = {...}, threadId=0) at search.cc:371

9 0x0000000000411f51 in std::_Bind_simple<void

(*(std::reference_wrapper, std::reference_wrapper, std::reference_wrapper, std::reference_wrapper<std::vector<int, std::allocator > >, int))(Position const&, search::Limits const&, zobrist::GameStack const&, std::vector<int, std::allocator >&, int)>::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) (this=0x7fa6b0002938) at /usr/include/c++/6.2.1/functional:1400

10 0x0000000000411d45 in std::_Bind_simple<void

(*(std::reference_wrapper, std::reference_wrapper, std::reference_wrapper, std::reference_wrapper<std::vector<int, std::allocator > >, int))(Position const&, search::Limits const&, zobrist::GameStack const&, std::vector<int, std::allocator >&, int)>::operator()() (this=0x7fa6b0002938) at /usr/include/c++/6.2.1/functional:1389

11 0x0000000000411c9c in std::thread::_State_impl<std::_Bind_simple<void

(*(std::reference_wrapper, std::reference_wrapper, std::reference_wrapper, std::reference_wrapper<std::vector<int, std::allocator > >, int))(Position const&, search::Limits const&, zobrist::GameStack const&, std::vector<int, std::allocator >&, int)> >::_M_run() (this=0x7fa6b0002930) at /usr/include/c++/6.2.1/thread:196

12 0x00007fa6bd93231f in std::execute_native_thread_routine

(__p=0x7fa6b0002930) at /build/gcc-multilib/src/gcc/libstdc++-v3/src/c++11/thread.cc:83

13 0x00007fa6bdc06454 in start_thread () from /usr/lib/libpthread.so.0

14 0x00007fa6bd0a67df in clone () from /usr/lib/libc.so.6

Kind regards,

               Antonio

On Sat, Nov 19, 2016 at 12:37 AM, lucasart notifications@github.com wrote:

Thanks. Unfortunately "I run the engine with Cutechess GUI" is not enough to reproduce. Can you do the same experiment with cutechess-cli instead. Please run as follows:

./cutechess-cli \ -each proto=uci tc=8+0.08 option.Hash=8 -variant 'fischerandom' \ -engine cmd=$1 name=$1 stderr=./errors \ -engine cmd=$2 name=$2 \ -rounds 100 \ -debug

where $1 is the path to a debug compile of demolito, and $2 any other engine that won't crash.

What I need is the last UCI communication (displayed on screen) and the file errors (stderr output including assert message will be captured there if any).

Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lucasart/Demolito/issues/64#issuecomment-261670272, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdO1ozzov2ifyotEIJvkd6HmPAoW0oxks5q_ja_gaJpZM4K0LHU .

lucasart commented 8 years ago

Thanks. So the minimal reproduction should be:

setoption name Hash value 128
setoption name UCI_Chess960 value true
ucinewgame
position fen rnbnkbqr/pppppppp/8/8/8/8/PPPPPPPP/RNBNKBQR w HAha - 0 1 moves b1c3 e7e6 e2e4 f8e7 d1e3 a7a6 d2d3 b8c6 c1d2 h7h5 c3e2 g8h7 e1a1 e8h8 c1b1 c6b4 g2g3 b7b5 e2f4 g7g5 f4e2 c8b7 f1g2 f7f6 h2h4 d8f7 g3g4 a6a5 h4g5 h5h4 g5g6 h7g6 h1h4 f7e5 g1h2 g6g7 d1h1 d7d5 h4h7
go wtime 3802 btime 4177 winc 80 binc 80

Can you confirm that, just by starting demolito in command line, and pasting the 5 commands one by one, you can reproduce the crash ? I cannot reproduce on my machine.

archtux commented 8 years ago

I can confirm that by pasting the 5 commands one by one demolito crashes immediately on my machine with the message : demolito: bitboard.cc:256: void bb::clear(bitboard_t&, Square): Assertion `test(b, s)' failed. Aborted (core dumped) I have a 64 bits Intel core i5 machine with 64 bits Linux OS. Demolito was compiled with gcc version 6.2.1 20160830 (GCC) cutechess-cli -v cutechess-cli 0.8.5 Using Qt version 5.7.0

On Sun, Nov 20, 2016 at 2:19 AM, lucasart notifications@github.com wrote:

Thanks. So the minimal reproduction should be:

setoption name Hash value 128 setoption name UCI_Chess960 value true ucinewgame position fen rnbnkbqr/pppppppp/8/8/8/8/PPPPPPPP/RNBNKBQR w HAha - 0 1 moves b1c3 e7e6 e2e4 f8e7 d1e3 a7a6 d2d3 b8c6 c1d2 h7h5 c3e2 g8h7 e1a1 e8h8 c1b1 c6b4 g2g3 b7b5 e2f4 g7g5 f4e2 c8b7 f1g2 f7f6 h2h4 d8f7 g3g4 a6a5 h4g5 h5h4 g5g6 h7g6 h1h4 f7e5 g1h2 g6g7 d1h1 d7d5 h4h7 go wtime 3802 btime 4177 winc 80 binc 80

Can you confirm that, just by starting demolito in command line, and pasting the 5 commands one by one, you can reproduce the crash ? I cannot reproduce on my machine.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lucasart/Demolito/issues/64#issuecomment-261751370, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdO1tZhW5uQJjKzSFsoFcUfR7GZk7WLks5q_6AbgaJpZM4K0LHU .

lucasart commented 8 years ago

Thanks. I can reproduce now. The trick (for me) was to compile with -Og instead of -O3. The minimal reproduction is simply:

ucinewgame
position fen r4rk1/1bp1b1qR/4pp2/pp1pn3/1n2P1P1/3PN3/PPPBNPBQ/1K5R b - - 1
go

So it's completely unrelated to the hash size, or to chess960. The bug should be easy to find now. I'll give it a crack when I have a bit of time.

lucasart commented 8 years ago

The bug is caused by an illegal move in the PV, which triggers an assert, as PV moves have to be played in uci::Info::update(). The illegal PV move is found at depth=1 search:

ucinewgame
position fen r4rk1/1bp1b1qR/4pp2/pp1pn3/1n2P1P1/3PN3/PPPBNPBQ/1K5R b - - 1
go
info depth 1 score cp -515 time 7 nodes 3241 nps 463000 pv g7g6 h7e7 d5e4 e7e6 e4d3 d2b4 a5b4 g2b7 d3e2 b7a8 *f2h1*

The last move is illegal. Seems to be linked to abruptly stopping the qsearch at MIN_DEPTH = -8. To be continued...

lucasart commented 8 years ago

fixed