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

Error in `./COINd': realloc(): invalid next size: 0x00007f070c001490 #673

Closed
DemonRx opened this issue Apr 13, 2019 · 1 comment
Closed

Comments

@DemonRx
Copy link

DemonRx commented Apr 13, 2019

OS: Ubuntu 16.04
Program: COINd (cryptocurrency daemon)

This error occurs during the POW mining phase, and at no specific block (seems random). Have not seen this happening when POW phase ends switching over to 100% POS.

One likely but not sure of possible culprit maybe this section of code:

leveldb/db/c.cc

Line 146 in 2f008ac

char* result = reinterpret_cast<char*>(malloc(sizeof(char) * str.size()));

What brings to focus this part of code causing the problem is because on restart of the daemon, it fails warning of the database being corrupted, which after further investigating this lead to some hint from https://stackoverflow.com/a/26661206 that leveldb maybe the code responsible for this issue.

Error Produced:

*** Error in `./COINd': realloc(): invalid next size: 0x00007f070c001490 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f07580b07e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x834aa)[0x7f07580bc4aa]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0x179)[0x7f07580bd839]
./COINd[0x52a20e]
./COINd[0x52bbee]
./COINd[0x52bd5b]
./COINd[0x720b62]
./COINd[0x6c316a]
./COINd[0x6db4d8]
./COINd[0x62f3cc]
./COINd[0x6119fe]
./COINd[0x615982]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb8c80)[0x7f0758bf7c80]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f075840a6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f075814041d]
======= Memory map: ========
00400000-00fb1000 r-xp 00000000 08:01 262166                             /home/demon/COINd
011b0000-011fc000 r--p 00bb0000 08:01 262166                             /home/demon/COINd
011fc000-011fe000 rw-p 00bfc000 08:01 262166                             /home/demon/COINd
011fe000-0127c000 rw-p 00000000 00:00 0 
028e1000-0297f000 rw-p 00000000 00:00 0                                  [heap]
0297f000-03416000 rw-p 00000000 00:00 0                                  [heap]
03416000-03417000 rw-p 00000000 00:00 0                                  [heap]
03417000-03418000 rw-p 00000000 00:00 0                                  [heap]
03418000-0341c000 rw-p 00000000 00:00 0                                  [heap]
0341c000-0341d000 rw-p 00000000 00:00 0                                  [heap]
0341d000-03422000 rw-p 00000000 00:00 0                                  [heap]
03422000-03423000 rw-p 00000000 00:00 0                                  [heap]
03423000-03424000 rw-p 00000000 00:00 0                                  [heap]
03424000-03426000 rw-p 00000000 00:00 0                                  [heap]
03426000-03427000 rw-p 00000000 00:00 0                                  [heap]
03427000-03428000 rw-p 00000000 00:00 0                                  [heap]
03428000-03429000 rw-p 00000000 00:00 0                                  [heap]
03429000-0342f000 rw-p 00000000 00:00 0                                  [heap]
0342f000-03430000 rw-p 00000000 00:00 0                                  [heap]
03430000-03432000 rw-p 00000000 00:00 0                                  [heap]
03432000-03433000 rw-p 00000000 00:00 0                                  [heap]
03433000-03439000 rw-p 00000000 00:00 0                                  [heap]
03439000-0343a000 rw-p 00000000 00:00 0                                  [heap]
0343a000-034f7000 rw-p 00000000 00:00 0                                  [heap]
7f070c000000-7f070c021000 rw-p 00000000 00:00 0 
7f070c021000-7f0710000000 ---p 00000000 00:00 0 
7f0710000000-7f0710021000 rw-p 00000000 00:00 0 
7f0710021000-7f0714000000 ---p 00000000 00:00 0 
7f0714000000-7f0714021000 rw-p 00000000 00:00 0 
7f0714021000-7f0718000000 ---p 00000000 00:00 0 
7f0718000000-7f0718021000 rw-p 00000000 00:00 0 
7f0718021000-7f071c000000 ---p 00000000 00:00 0 
7f071c000000-7f071c021000 rw-p 00000000 00:00 0 
7f071c021000-7f0720000000 ---p 00000000 00:00 0 
7f0720000000-7f0720021000 rw-p 00000000 00:00 0 
7f0720021000-7f0724000000 ---p 00000000 00:00 0 
7f0724000000-7f0724021000 rw-p 00000000 00:00 0 
7f0724021000-7f0728000000 ---p 00000000 00:00 0 
7f0728000000-7f0728021000 rw-p 00000000 00:00 0 
7f0728021000-7f072c000000 ---p 00000000 00:00 0 
7f072c000000-7f072c021000 rw-p 00000000 00:00 0 
7f072c021000-7f0730000000 ---p 00000000 00:00 0 
7f0730000000-7f0730021000 rw-p 00000000 00:00 0 
7f0730021000-7f0734000000 ---p 00000000 00:00 0 
7f0734000000-7f0734021000 rw-p 00000000 00:00 0 
7f0734021000-7f0738000000 ---p 00000000 00:00 0 
7f0738000000-7f0738021000 rw-p 00000000 00:00 0 
7f0738021000-7f073c000000 ---p 00000000 00:00 0 
7f073c000000-7f073c021000 rw-p 00000000 00:00 0 
7f073c021000-7f0740000000 ---p 00000000 00:00 0 
7f0742a7d000-7f0742a7e000 ---p 00000000 00:00 0 
7f0742a7e000-7f074327e000 rw-p 00000000 00:00 0 
7f0744a79000-7f0744a7a000 ---p 00000000 00:00 0 
7f0744a7a000-7f074527a000 rw-p 00000000 00:00 0 
7f074527a000-7f074527b000 ---p 00000000 00:00 0 
7f074527b000-7f0745a7b000 rw-p 00000000 00:00 0 
7f0745a7b000-7f0745a7c000 ---p 00000000 00:00 0 
7f0745a7c000-7f074627c000 rw-p 00000000 00:00 0 
7f074627c000-7f074627d000 ---p 00000000 00:00 0 
7f074627d000-7f0746a7d000 rw-p 00000000 00:00 0 
7f0746a7d000-7f0746a7e000 ---p 00000000 00:00 0 
7f0746a7e000-7f074727e000 rw-p 00000000 00:00 0 
7f074727e000-7f074727f000 ---p 00000000 00:00 0 
7f074727f000-7f0748000000 rw-p 00000000 00:00 0 
7f0748000000-7f0748023000 rw-p 00000000 00:00 0 
7f0748023000-7f074c000000 ---p 00000000 00:00 0 
7f074c2ac000-7f074c7f9000 rw-p 00000000 00:00 0 
7f074c7f9000-7f074c7fa000 ---p 00000000 00:00 0 
7f074c7fa000-7f074cffa000 rw-p 00000000 00:00 0 
7f074cffa000-7f074cffb000 ---p 00000000 00:00 0 
7f074cffb000-7f074d7fb000 rw-p 00000000 00:00 0 
7f074d7fb000-7f074d7fc000 ---p 00000000 00:00 0 
7f074d7fc000-7f074dffc000 rw-p 00000000 00:00 0 
7f074dffc000-7f074dffd000 ---p 00000000 00:00 0 
7f074dffd000-7f074e7fd000 rw-p 00000000 00:00 0 
7f074e7fd000-7f074e7fe000 ---p 00000000 00:00 0 
7f074e7fe000-7f074effe000 rw-p 00000000 00:00 0 
7f074effe000-7f074efff000 ---p 00000000 00:00 0 
7f074efff000-7f074f7ff000 rw-p 00000000 00:00 0 
7f074f7ff000-7f074f800000 ---p 00000000 00:00 0 
7f074f800000-7f0750000000 rw-p 00000000 00:00 0 
7f0750000000-7f0750021000 rw-p 00000000 00:00 0 
7f0750021000-7f0754000000 ---p 00000000 00:00 0 
7f07543a4000-7f07543a5000 ---p 00000000 00:00 0 
7f07543a5000-7f0754ba5000 rw-p 00000000 00:00 0 
7f0754ba5000-7f0754ba6000 ---p 00000000 00:00 0 
7f0754ba6000-7f07553a6000 rw-p 00000000 00:00 0 
7f07553a6000-7f07553a7000 ---p 00000000 00:00 0 
7f07553a7000-7f0755ba7000 rw-p 00000000 00:00 0 
7f0755ba7000-7f0755ba8000 ---p 00000000 00:00 0 
7f0755ba8000-7f07573a9000 rw-p 00000000 00:00 0 
7f07573a9000-7f0757681000 r--p 00000000 08:01 1706053                    /usr/lib/locale/locale-archive
7f0757681000-7f07577a5000 rw-p 00000000 00:00 0 
7f07577a5000-7f07577ce000 r-xp 00000000 08:01 1718344                    /usr/lib/x86_64-linux-gnu/libevent_core-2.0.so.5.1.9
7f07577ce000-7f07579cd000 ---p 00029000 08:01 1718344                    /usr/lib/x86_64-linux-gnu/libevent_core-2.0.so.5.1.9
7f07579cd000-7f07579ce000 r--p 00028000 08:01 1718344                    /usr/lib/x86_64-linux-gnu/libevent_core-2.0.so.5.1.9
7f07579ce000-7f07579cf000 rw-p 00029000 08:01 1718344                    /usr/lib/x86_64-linux-gnu/libevent_core-2.0.so.5.1.9
7f07579cf000-7f0757a2c000 r-xp 00000000 08:01 1709098                    /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1
7f0757a2c000-7f0757c2b000 ---p 0005d000 08:01 1709098                    /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1
7f0757c2b000-7f0757c2c000 r--p 0005c000 08:01 1709098                    /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1
7f0757c2c000-7f0757c2d000 rw-p 0005d000 08:01 1709098                    /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1
7f0757c2d000-7f0757c30000 r-xp 00000000 08:01 917661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7f0757c30000-7f0757e2f000 ---p 00003000 08:01 917661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7f0757e2f000-7f0757e30000 r--p 00002000 08:01 917661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7f0757e30000-7f0757e31000 rw-p 00003000 08:01 917661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7f0757e31000-7f0757e38000 r-xp 00000000 08:01 917658                     /lib/x86_64-linux-gnu/librt-2.23.so
7f0757e38000-7f0758037000 ---p 00007000 08:01 917658                     /lib/x86_64-linux-gnu/librt-2.23.so
7f0758037000-7f0758038000 r--p 00006000 08:01 917658                     /lib/x86_64-linux-gnu/librt-2.23.so
7f0758038000-7f0758039000 rw-p 00007000 08:01 917658                     /lib/x86_64-linux-gnu/librt-2.23.so
7f0758039000-7f07581f9000 r-xp 00000000 08:01 917684                     /lib/x86_64-linux-gnu/libc-2.23.so
7f07581f9000-7f07583f9000 ---p 001c0000 08:01 917684                     /lib/x86_64-linux-gnu/libc-2.23.so
7f07583f9000-7f07583fd000 r--p 001c0000 08:01 917684                     /lib/x86_64-linux-gnu/libc-2.23.so
7f07583fd000-7f07583ff000 rw-p 001c4000 08:01 917684                     /lib/x86_64-linux-gnu/libc-2.23.so
7f07583ff000-7f0758403000 rw-p 00000000 00:00 0 
7f0758403000-7f075841b000 r-xp 00000000 08:01 917665                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7f075841b000-7f075861a000 ---p 00018000 08:01 917665                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7f075861a000-7f075861b000 r--p 00017000 08:01 917665                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7f075861b000-7f075861c000 rw-p 00018000 08:01 917665                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7f075861c000-7f0758620000 rw-p 00000000 00:00 0 
7f0758620000-7f0758636000 r-xp 00000000 08:01 918031                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0758636000-7f0758835000 ---p 00016000 08:01 918031                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0758835000-7f0758836000 rw-p 00015000 08:01 918031                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0758836000-7f075893e000 r-xp 00000000 08:01 917687                     /lib/x86_64-linux-gnu/libm-2.23.so
7f075893e000-7f0758b3d000 ---p 00108000 08:01 917687                     /lib/x86_64-linux-gnu/libm-2.23.so
7f0758b3d000-7f0758b3e000 r--p 00107000 08:01 917687                     /lib/x86_64-linux-gnu/libm-2.23.so
7f0758b3e000-7f0758b3f000 rw-p 00108000 08:01 917687                     /lib/x86_64-linux-gnu/libm-2.23.so
7f0758b3f000-7f0758cb1000 r-xp 00000000 08:01 1708079                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f0758cb1000-7f0758eb1000 ---p 00172000 08:01 1708079                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f0758eb1000-7f0758ebb000 r--p 00172000 08:01 1708079                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f0758ebb000-7f0758ebd000 rw-p 0017c000 08:01 1708079                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f0758ebd000-7f0758ec1000 rw-p 00000000 00:00 0 
7f0758ec1000-7f0758f05000 r-xp 00000000 08:01 1711143                    /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.9
7f0758f05000-7f0759105000 ---p 00044000 08:01 1711143                    /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.9
7f0759105000-7f0759106000 r--p 00044000 08:01 1711143                    /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.9
7f0759106000-7f0759107000 rw-p 00045000 08:01 1711143                    /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.9
7f0759107000-7f0759109000 r-xp 00000000 08:01 1718346                    /usr/lib/x86_64-linux-gnu/libevent_pthreads-2.0.so.5.1.9
7f0759109000-7f0759308000 ---p 00002000 08:01 1718346                    /usr/lib/x86_64-linux-gnu/libevent_pthreads-2.0.so.5.1.9
7f0759308000-7f0759309000 r--p 00001000 08:01 1718346                    /usr/lib/x86_64-linux-gnu/libevent_pthreads-2.0.so.5.1.9
7f0759309000-7f075930a000 rw-p 00002000 08:01 1718346                    /usr/lib/x86_64-linux-gnu/libevent_pthreads-2.0.so.5.1.9
7f075930a000-7f075936c000 r-xp 00000000 08:01 1709100                    /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0
7f075936c000-7f075956b000 ---p 00062000 08:01 1709100                    /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0
7f075956b000-7f075956f000 r--p 00061000 08:01 1709100                    /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0
7f075956f000-7f0759570000 rw-p 00065000 08:01 1709100                    /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0
7f0759570000-7f075957b000 r-xp 00000000 08:01 1711975                    /usr/lib/x86_64-linux-gnu/libminiupnpc.so.10
7f075957b000-7f075977b000 ---p 0000b000 08:01 1711975                    /usr/lib/x86_64-linux-gnu/libminiupnpc.so.10
7f075977b000-7f075977c000 r--p 0000b000 08:01 1711975                    /usr/lib/x86_64-linux-gnu/libminiupnpc.so.10
7f075977c000-7f075977d000 rw-p 0000c000 08:01 1711975                    /usr/lib/x86_64-linux-gnu/libminiupnpc.so.10
7f075977d000-7f0759998000 r-xp 00000000 08:01 917521                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f0759998000-7f0759b97000 ---p 0021b000 08:01 917521                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f0759b97000-7f0759bb3000 r--p 0021a000 08:01 917521                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f0759bb3000-7f0759bbf000 rw-p 00236000 08:01 917521                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f0759bbf000-7f0759bc2000 rw-p 00000000 00:00 0 
7f0759bc2000-7f0759d60000 r-xp 00000000 08:01 1711961                    /usr/lib/libdb_cxx-4.8.so
7f0759d60000-7f0759f60000 ---p 0019e000 08:01 1711961                    /usr/lib/libdb_cxx-4.8.so
7f0759f60000-7f0759f63000 r--p 0019e000 08:01 1711961                    /usr/lib/libdb_cxx-4.8.so
7f0759f63000-7f0759f66000 rw-p 001a1000 08:01 1711961                    /usr/lib/libdb_cxx-4.8.so
7f0759f66000-7f0759f6c000 r-xp 00000000 08:01 1709515                    /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.58.0
7f0759f6c000-7f075a16c000 ---p 00006000 08:01 1709515                    /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.58.0
7f075a16c000-7f075a16d000 r--p 00006000 08:01 1709515                    /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.58.0
7f075a16d000-7f075a16e000 rw-p 00007000 08:01 1709515                    /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.58.0
7f075a16e000-7f075a173000 r-xp 00000000 08:01 1711208                    /usr/lib/x86_64-linux-gnu/libboost_random.so.1.58.0
7f075a173000-7f075a373000 ---p 00005000 08:01 1711208                    /usr/lib/x86_64-linux-gnu/libboost_random.so.1.58.0
7f075a373000-7f075a374000 r--p 00005000 08:01 1711208                    /usr/lib/x86_64-linux-gnu/libboost_random.so.1.58.0
7f075a374000-7f075a375000 rw-p 00006000 08:01 1711208                    /usr/lib/x86_64-linux-gnu/libboost_random.so.1.58.0
7f075a375000-7f075a399000 r-xp 00000000 08:01 1709518                    /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
7f075a399000-7f075a598000 ---p 00024000 08:01 1709518                    /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
7f075a598000-7f075a59a000 r--p 00023000 08:01 1709518                    /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
7f075a59a000-7f075a59b000 rw-p 00025000 08:01 1709518                    /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
7f075a59b000-7f075a615000 r-xp 00000000 08:01 1710628                    /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.58.0
7f075a615000-7f075a815000 ---p 0007a000 08:01 1710628                    /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.58.0
7f075a815000-7f075a818000 r--p 0007a000 08:01 1710628                    /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.58.0
7f075a818000-7f075a819000 rw-p 0007d000 08:01 1710628                    /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.58.0
7f075a819000-7f075a830000 r-xp 00000000 08:01 1709103                    /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.58.0
7f075a830000-7f075aa2f000 ---p 00017000 08:01 1709103                    /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.58.0
7f075aa2f000-7f075aa30000 r--p 00016000 08:01 1709103                    /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.58.0
7f075aa30000-7f075aa31000 rw-p 00017000 08:01 1709103                    /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.58.0
7f075aa31000-7f075aa34000 r-xp 00000000 08:01 1709102                    /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0
7f075aa34000-7f075ac33000 ---p 00003000 08:01 1709102                    /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0
7f075ac33000-7f075ac34000 r--p 00002000 08:01 1709102                    /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0
7f075ac34000-7f075ac35000 rw-p 00003000 08:01 1709102                    /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0
7f075ac35000-7f075ac5b000 r-xp 00000000 08:01 917663                     /lib/x86_64-linux-gnu/ld-2.23.so
7f075ad08000-7f075ad3d000 r--s 00000000 08:01 1967226                    /var/cache/nscd/hosts
7f075ad3d000-7f075ae3e000 rw-p 00000000 00:00 0 
7f075ae3e000-7f075ae4d000 rw-p 00000000 00:00 0 
7f075ae52000-7f075ae53000 rw-p 00000000 00:00 0 
7f075ae53000-7f075ae5a000 r--s 00000000 08:01 1719082                    /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f075ae5a000-7f075ae5b000 r--p 00025000 08:01 917663                     /lib/x86_64-linux-gnu/ld-2.23.so
7f075ae5b000-7f075ae5c000 rw-p 00026000 08:01 917663                     /lib/x86_64-linux-gnu/ld-2.23.so
7f075ae5c000-7f075ae5d000 rw-p 00000000 00:00 0 
7fffde2c5000-7fffde2e6000 rw-p 00000000 00:00 0                          [stack]
7fffde37c000-7fffde37f000 r--p 00000000 00:00 0                          [vvar]
7fffde37f000-7fffde381000 r-xp 00000000 00:00 0                          [vdso]
@DemonRx DemonRx changed the title Error in `./COINd': realloc(): invalid next size: 0x00007f070c001490 #6 Error in `./COINd': realloc(): invalid next size: 0x00007f070c001490 Apr 13, 2019
@cmumford
Copy link
Contributor

@D3m0nKingx I don't see a problem with CopyString and it appears to be correct. Thanks for the report and please feel free to reopen this issue if you have any more reason to believe leveldb is the cause.

maochongxin pushed a commit to maochongxin/leveldb that referenced this issue Jul 21, 2022
…with clang-cl" (google#673)

`MSVC` is true for clang-cl, but `"${CMAKE_CXX_COMPILER_ID}" STREQUAL
"MSVC"` is false, so we would enable -Wall, which means -Weverything
with clang-cl, and we get tons of undesired warnings.

Use the simpler condition to fix things.

Patch by: Reid Kleckner @rnk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants