dosyago / dn

💾 dn - offline full-text search and archiving for your Chromium-based browser.
https://localhost:22120
Other
3.78k stars 145 forks source link

Index writes fail when machine is put to sleep during DiskerNet session #155

Closed jasoncyu closed 3 months ago

jasoncyu commented 1 year ago

When running normally, my index shows pages with indices that increment by 1 for each new page. Sometimes diskernet stops recording my browsing, and then after a restart, it starts working again, and the indices numbering resumes at a higher number. Notice the jump from 408 to 656 below

image

There's also a ">" that appears in the console output for the diskernet process, might be an interactive promprt for something? Looks like this:

Waiting 1 second...
{"server_up":{"upAt":"2023-03-06T17:29:51.762Z","port":22120}}
Launching chrome...
  LH:ChromeLauncher No debugging port found on port 9222, launching a new Chrome. +0ms
  LH:ChromeLauncher:verbose created /var/folders/k_/_zw7yvms12l_1dgj86ygp8mw0000gn/T/lighthouse.XXXXXXX.NpM6NgGi +19ms
  LH:ChromeLauncher:verbose Launching with command:
  LH:ChromeLauncher:verbose "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222 --disk-cache-dir=/Users/jason/.config/dosyago/DiskerNet/22120-arc/temp-browser-cache0.19165503657405947 --aggressive-cache-discard http://localhost:22120 +1ms
  LH:ChromeLauncher:verbose Chrome running with pid 13721 on port 9222. +4ms
  LH:ChromeLauncher Waiting for browser. +1ms
  LH:ChromeLauncher Waiting for browser... +0ms
  LH:ChromeLauncher Waiting for browser..... +501ms
  LH:ChromeLauncher Waiting for browser....... +501ms
  LH:ChromeLauncher Waiting for browser.......✓ +1ms
Chrome started.
Waiting 1 second...
Launching archivist and connecting to browser...
{ Mode: 'save' }
Not observing
System ready.
>

Any guidance on debugging/fixing this?

o0101 commented 1 year ago

Thank you for this report, @jasoncyu! I have not seen this before. Will look at it when time.

It may help if you post debug output as well. Check README for how

Thank you again for this feedback, you're helping make the product better!

jasoncyu commented 1 year ago

The main project README? I didn't see any debug output instructions. I did read all the issues and I did see elsewhere that if you set export DEBUG_22120=abc then you get some additional log output. I'll monitor and let you know, thanks!

jasoncyu commented 1 year ago

Ah ok I can actually reliably reproduce the issue, if I put my machine to sleep, even for just a second, then when I wake it back up diskernet won't write to the index. Weirdly for URL's where it does save the index under normal operation I do get this error

Could not form url undefined TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:393:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:645:5)
    at neverCache (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:330:9690)
    at reloadIfNotLive (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:330:9312)
    at /Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:135:2509
    at vo.f (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:135:1984)
    at vo.emit (node:events:513:28)
    at lv.zq (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:54:42618)
    at lv.emit (node:events:513:28) {
  input: 'undefined',
  code: 'ERR_INVALID_URL'
}

but for URL's where it doesn't save the history, I don't get any log output

o0101 commented 1 year ago

The main project README? I didn't see any debug output instructions. I did read all the issues and I did see elsewhere that if you set export DEBUG_22120=abc then you get some additional log output. I'll monitor and let you know, thanks!

Ah yes! Thank you. I'm sorry for my mistake.

o0101 commented 1 year ago

Ah ok I can actually reliably reproduce the issue, if I put my machine to sleep, even for just a second, then when I wake it back up diskernet won't write to the index. Weirdly for URL's where it does save the index under normal operation I do get this error

Could not form url undefined TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:393:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:645:5)
    at neverCache (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:330:9690)
    at reloadIfNotLive (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:330:9312)
    at /Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:135:2509
    at vo.f (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:135:1984)
    at vo.emit (node:events:513:28)
    at lv.zq (/Users/jason/Library/Application Support/fnm/node-versions/v18.12.1/installation/lib/node_modules/diskernet/build/diskernet.cjs:54:42618)
    at lv.emit (node:events:513:28) {
  input: 'undefined',
  code: 'ERR_INVALID_URL'
}

but for URL's where it doesn't save the history, I don't get any log output

Excellent bit of information, thanks! That should give us a way to triangulate it, when time.

o0101 commented 3 months ago

should be fixed