pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
115 stars 28 forks source link

Windows 10 - Pocketcoin-qt crashes with EXCEPTION: N5boost10filesystem16filesystem_errorE #725

Open the-real-vortex-v opened 3 months ago

the-real-vortex-v commented 3 months ago

Node crashes (I didn't get the dialog box. It was a little different) with an exception.

debug.log:

2024-07-28T21:53:50Z


EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::remove: The process cannot access the file because it is being used by another process [system:32]: "d:\Coins\Pocketnet\Data\peers.2c38"
D:\Coins\Pocketnet\PocketnetCore\pocketcoin-qt.exe in scheduler

2024-07-28T21:54:06Z +++ Block connected to chain: 2867828 BH: 018dc0f9591b51f7d3c305d02d7f5218912a7db51900fe1e5d86de6e86655255 2024-07-28T21:54:17Z +++ Block connected to chain: 2867829 BH: b134a75c92a5da5d74a7473737d6c0a2d2901b10dfbe5e387e5ad0c0145e77b2

Windows event log:

Fault bucket 1928468963264097218, type 5 Event Name: RADAR_PRE_LEAK_64 Response: Not available Cab Id: 0

Problem signature: P1: pocketcoin-qt.exe P2: 0.22.5.0 P3: 10.0.19045.2.0.0 P4: P5: P6: P7: P8: P9: P10:

Desktop (please complete the following information):

Windows V10

Additional context

This crash is new and never happened in the previous versions.

HiHat commented 3 months ago

Seems that file was locked by another process (antiviral software?). Please try adding data directory path (D:\Coins\Pocketnet\Data) to Windows defender (or other antiviral software) exclusion list!

the-real-vortex-v commented 3 months ago

Seems that file was locked by another process (antiviral software?). Please try adding data directory path (D:\Coins\Pocketnet\Data) to Windows defender (or other antiviral software) exclusion list!

This is a new crash. I've never had this in windows 10 before after running the node for multiple years. I've added the directory to defender but I doubt this is why it crashed. Perhaps some code was changed around the peers.dat files? peers.2c38 I assume is a temp file. Do you know where it's created in the code?

the-real-vortex-v commented 3 months ago

Seems that file was locked by another process (antiviral software?). Please try adding data directory path (D:\Coins\Pocketnet\Data) to Windows defender (or other antiviral software) exclusion list!

I know it's low priority but there should be a change in logging that would make debugging this kind of stuff much nicer.

For example:

// Load addresses from peers.dat int64_t nStart = GetTimeMillis(); { CAddrDB adb; if (adb.Read(addrman)) LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart); else { addrman.Clear(); // Addrman can be in an inconsistent state after failure, reset it LogPrintf("Invalid or missing peers.dat; recreating\n"); DumpAddresses(); } }

I would have two LogPrintF statements. One before the addrman.Clear() saying LogPrintf("Invalid or missing peers.dat;"); and one after that shows it was done. LogPrintf(" ... recreated\n);

If there's an issue between the statements you know you have a problem. Currently having the logging happen after the function means you don't get any useful information about why an exception happened.

You guys have your ways of doing things and I'm no developer but it seems to me that it'd be nicer this way.

andyoknen commented 3 months ago

@the-real-vortex-v Hi! Is your problem reproducible? If the interference of third-party programs really took place, then this is a single action, if not, then the error may repeat.

the-real-vortex-v commented 3 months ago

@the-real-vortex-v Hi! Is your problem reproducible? If the interference of third-party programs really took place, then this is a single action, if not, then the error may repeat.

I have no idea. I just stopped the 22.4 version. Ran the installer for 22.5 and then waited and the crash happened. I only have windows defender running and this has never happened with any other version of the software.

Maybe some more error logic around that function could do the trick? like try X times rather than only once to delete the file?

I had a quick look and the only code I can find that seems to be related is this:

bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data& data) { // Generate random temporary filename uint16_t randv = 0; GetRandBytes((unsigned char*)&randv, sizeof(randv)); std::string tmpfn = strprintf("%s.%04x", prefix, randv);

// open temp output file, and associate with CAutoFile
fs::path pathTmp = GetDataDir() / tmpfn;
FILE *file = fsbridge::fopen(pathTmp, "wb");
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
if (fileout.IsNull()) {
    fileout.fclose();
    remove(pathTmp);
    return error("%s: Failed to open file %s", __func__, pathTmp.string());
}

It's the only place a random file name is generated as far as I can tell.

the-real-vortex-v commented 3 months ago

Crash again:

image

Also this in the log:

2024-07-31T11:55:29Z +++ Block connected to chain: 2871576 BH: d4e31c4f0a27105c5b7f0686479e436c9135bc1bd21c5c9ae1eb7a6a003af3de 2024-07-31T11:55:44Z New outbound peer connected: version=/Satoshi:0.22.4/, blocks=2871576, peer=35, peeraddr=188.190.156.10:37070 (block-relay) 2024-07-31T11:55:51Z


EXCEPTION: St13runtime_error
Transaction::List reconstruct failed - no return data for cf1b2cd2d2ba79e238df11796665c9c79c6816c922086af8ada63afb92394e96 tx
D:\Coins\Pocketnet\PocketnetCore\pocketcoin-qt.exe in msghand

2024-07-31T11:57:07Z GUI: Check updates result: error: QNetworkReply::NetworkError(ProtocolUnknownError) 2024-07-31T12:06:43Z Potential stale tip detected, will try using extra outbound peer (last tip update: 674 seconds ago) 2024-07-31T12:15:17Z socket sending timeout: 1201s 2024-07-31T12:15:44Z socket sending timeout: 1201s 2024-07-31T12:15:45Z socket sending timeout: 1201s 2024-07-31T12:15:46Z socket sending timeout: 1201s 2024-07-31T12:15:46Z socket sending timeout: 1201s 2024-07-31T12:15:47Z socket sending timeout: 1201s 2024-07-31T12:15:47Z socket sending timeout: 1201s 2024-07-31T12:15:48Z socket sending timeout: 1201s 2024-07-31T12:15:48Z socket sending timeout: 1201s 2024-07-31T12:15:49Z socket sending timeout: 1201s 2024-07-31T12:17:13Z Potential stale tip detected, will try using extra outbound peer (last tip update: 1304 seconds ago) 2024-07-31T12:27:43Z Potential stale tip detected, will try using extra outbound peer (last tip update: 1934 seconds ago) 2024-07-31T12:38:13Z Potential stale tip detected, will try using extra outbound peer (last tip update: 2564 seconds ago) 2024-07-31T12:48:43Z Potential stale tip detected, will try using extra outbound peer (last tip update: 3194 seconds ago) 2024-07-31T12:57:07Z GUI: Check updates result: error: QNetworkReply::NetworkError(ProtocolUnknownError) 2024-07-31T12:59:13Z Potential stale tip detected, will try using extra outbound peer (last tip update: 3824 seconds ago) 2024-07-31T13:09:43Z Potential stale tip detected, will try using extra outbound peer (last tip update: 4454 seconds ago) 2024-07-31T13:20:13Z Potential stale tip detected, will try using extra outbound peer (last tip update: 5084 seconds ago)

I will add this to the ticket that the other guys opened as it looks like this is a different issue?

andyoknen commented 2 months ago

What is the situation with this problem in version 0.22.6?

github-actions[bot] commented 1 day ago

This issue is stale because it has been open for 30 days with no activity.

the-real-vortex-v commented 5 hours ago

What is the situation with this problem in version 0.22.6?

This has stopped happening in the next version 0.22.7. It isn't happening now. It seems to me that some change in this version caused this issue as it wasn't happening in the version prior also.

Either way it's not an issue now. I haven't tried the 0.22.8 version yet. However based on the changes I can see I doubt it's going to happen in the new version. If it happens again I'll update here or make a new bug report.