iron-fish / ironfish

A novel cryptocurrency focused on privacy and accessibility.
https://ironfish.network
Mozilla Public License 2.0
962 stars 575 forks source link

Error: Failed to unwrap shared reference of NativeTransactionPosted type from napi value #1022

Closed crProductGuy closed 2 years ago

crProductGuy commented 2 years ago

Apparent new bug in 0.1.22. Caused a node crash (miner kept going and was doing "not connected to a node - waiting ...").

Had been running fine for 2-3 hours before this on 0.1.22.

Environment: Windows 11 64-bit, Ryzen 5700G, installed from source.

Full text including a few lines of node operation before:

Added block seq: 115580, hash: 00000...849ea, txs: 1, progress: 100.00%, time: 27.6ms Reorganizing chain from 00000...6b9ec (115596) for 00000...56b3a (115596) on prev 00000...20744 (115595) Reorganized chain. blocks: 1, old: 00000...6b9ec (115596), new: 00000...20744 (115595), fork: 00000...20744 (115595) Added block seq: 115600, hash: 00000...25688, txs: 1, progress: 100.00%, time: 25.8ms c:\Users\Marktest2\source\Repos\ironfish\ironfish\build\src\primitives\transaction.js:145 return this.withReference((t) => t.expirationSequence()); ^

Error: Failed to unwrap shared reference of NativeTransactionPosted type from napi value at c:\Users\Marktest2\source\Repos\ironfish\ironfish\build\src\primitives\transaction.js:145:44 at Transaction.withReference (c:\Users\Marktest2\source\Repos\ironfish\ironfish\build\src\primitives\transaction.js:45:24) at Transaction.expirationSequence (c:\Users\Marktest2\source\Repos\ironfish\ironfish\build\src\primitives\transaction.js:145:21) at Accounts.expireTransactions (c:\Users\Marktest2\source\Repos\ironfish\ironfish\build\src\account\accounts.js:571:81) at async Accounts.eventLoop (c:\Users\Marktest2\source\Repos\ironfish\ironfish\build\src\account\accounts.js:153:9) { code: 'InvalidArg' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

NullSoldier commented 2 years ago

Nice, were putting in a fix for this very soon.

dguenther commented 2 years ago

@urfinjs reported in #1032 that this is still an issue on 0.1.23.

For anyone who's seeing these crashes, how frequently are you seeing them? I'm having trouble pinning down the exact conditions that cause this crash, so if you've noticed it in any particular circumstances, that'd be really helpful.

Also, would you be able to try out the branch test-fix-reference and see if that appears to fix the issue?

urfinjs commented 2 years ago

This ironfish node crashed after ~10h of work.

Environment: ubuntu 20.04 minimal, Xeon E3-1245 V2 @3.4GHz, 32GB RAM. Build from source, run as a systemd service.

Added block to fork seq: 99953, head-seq: 118448, hash: 00000...7b2cc, head-hash: 00000...75936, work: 355980538500038539, head-work: 749592902270432761, work-diff: 393612363770394222
Added block seq: 118460, hash: 00000...f5c75, txs: 1, progress: 100.00%, time: 38.0ms
/root/ironfish/ironfish/build/src/primitives/transaction.js:64
        return this.withReference((t) => t.notesLength());
                                           ^
Error: Failed to unwrap shared reference of `NativeTransactionPosted` type from napi value
    at /root/ironfish/ironfish/build/src/primitives/transaction.js:64:44
    at Transaction.withReference (/root/ironfish/ironfish/build/src/primitives/transaction.js:45:24)
    at Transaction.notesLength (/root/ironfish/ironfish/build/src/primitives/transaction.js:64:21)
    at Transaction.notes (/root/ironfish/ironfish/build/src/primitives/transaction.js:79:34)
    at notes.next (<anonymous>)
    at Accounts.decryptNotes (/root/ironfish/ironfish/build/src/account/accounts.js:220:20)
    at /root/ironfish/ironfish/build/src/account/accounts.js:272:32
    at Transaction.withReference (/root/ironfish/ironfish/build/src/primitives/transaction.js:45:24)
    at Accounts.syncTransaction (/root/ironfish/ironfish/build/src/account/accounts.js:271:27)
    at /root/ironfish/ironfish/build/src/account/accounts.js:45:28 {
  code: 'InvalidArg'
}
error Command failed with exit code 1.
crProductGuy commented 2 years ago

Captured: Extra debug logs from 'test-fix-reference' branch. Crash happened on my 2nd Ryzen 5700 overnight 18feb. Files here are a zip of an RTF file of last several log lines w- error. and a screenshot of that.

IF Node Crash 0 1 22 - transaction js exception - t expirationSequence 2022-02-15 224108 ZIP-ProductGuy's Issue1022 log capture of logs from branch 'test-fix-reference' of Node crash- Re Issue 1022 18feb22.zip

crProductGuy commented 2 years ago

New crash on my 1st miner/node: Ryzen1. System had been running fine for 2+ days on the test-fix-reference version; this was the first such crash on this machine. Screenshot and text log attached.

ZIP-Log text for Failed to unwrap shared reference -ProductGuy Ryzen1-20feb22.zip Screenshot--Failed to Unwrap Shared Reference - ProductGuy Ryzen1--2022-02-20 234838

crProductGuy commented 2 years ago

3rd crash with logs, 21feb. 2nd one on my 1st miner. Could not upload the file to this Issue either as a text file or as a zip. Text file is attached to this Discord message in Community-Dev channel: https://discord.com/channels/771503434028941353/831945060777852998/945608914114842634

crProductGuy commented 2 years ago

4th crash with logs. This is 2nd crash in 4 days on 2nd miner. Crashed early AM on 22feb. Product Guy's 2nd Ryzen miner 2nd crash on Reference issue 1022.txt

mat-if commented 2 years ago

Going to close this since I believe the issue is fixed. If someone sees it again after 0.1.25, feel free to re-open