@bobfrankston/mailx-imap 0.1.95 → 0.1.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +23 -8
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -3430,12 +3430,27 @@ export class ImapManager extends EventEmitter {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
}
|
|
3432
3432
|
catch (e) {
|
|
3433
|
-
|
|
3434
|
-
//
|
|
3435
|
-
// corrupt body
|
|
3436
|
-
//
|
|
3437
|
-
//
|
|
3438
|
-
//
|
|
3433
|
+
const emsg = String(e?.message || e);
|
|
3434
|
+
// "IMAP command leaked into response stream" /
|
|
3435
|
+
// "corrupt body" means the byte-buffer parser lost
|
|
3436
|
+
// sync — a partial/flaky read shifted a literal
|
|
3437
|
+
// boundary so this FETCH body captured a later
|
|
3438
|
+
// command's bytes. The MESSAGE is probably fine; the
|
|
3439
|
+
// CONNECTION is poisoned (every subsequent read on
|
|
3440
|
+
// it is now garbage). Re-throw so withConnection
|
|
3441
|
+
// discards this client and the next chunk reconnects
|
|
3442
|
+
// clean — instead of marking a good message as poison
|
|
3443
|
+
// and limping on a dead socket until the 300s timeout,
|
|
3444
|
+
// which left bobma INBOX stuck and "no new mail"
|
|
3445
|
+
// (Bob 2026-06-15). Do NOT back the UID off; it
|
|
3446
|
+
// retries next tick on a clean connection.
|
|
3447
|
+
if (/command leaked|corrupt body|desync/i.test(emsg)) {
|
|
3448
|
+
console.error(` [prefetch] ${accountId}/${uid}: connection desync — discarding socket to resync: ${emsg.slice(0, 90)}`);
|
|
3449
|
+
throw new Error(`imap-desync: ${emsg.slice(0, 80)}`);
|
|
3450
|
+
}
|
|
3451
|
+
console.error(` [prefetch] ${accountId}/${uid}: store write failed: ${emsg}`);
|
|
3452
|
+
// Genuine poison body (not a desync): back off
|
|
3453
|
+
// 5m→30m→2h→12h so it isn't re-fetched on a loop.
|
|
3439
3454
|
this.markPrefetchEmpty(accountId, folderId, uid);
|
|
3440
3455
|
}
|
|
3441
3456
|
})());
|
|
@@ -3481,9 +3496,9 @@ export class ImapManager extends EventEmitter {
|
|
|
3481
3496
|
// (markPrefetchEmpty is per-message poison only) —
|
|
3482
3497
|
// they retry next tick. Genuine per-body errors are
|
|
3483
3498
|
// handled per-UID above and never reach here.
|
|
3484
|
-
const dead = /not connected|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EPIPE|socket|connection (closed|reset|lost)|disconnect/i.test(msg);
|
|
3499
|
+
const dead = /not connected|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EPIPE|socket|connection (closed|reset|lost)|disconnect|imap-desync/i.test(msg);
|
|
3485
3500
|
if (dead) {
|
|
3486
|
-
console.log(` [prefetch] ${accountId}/${folder.path}: connection down — deferring rest to next tick`);
|
|
3501
|
+
console.log(` [prefetch] ${accountId}/${folder.path}: connection down/desync — deferring rest to next tick (fresh socket)`);
|
|
3487
3502
|
break;
|
|
3488
3503
|
}
|
|
3489
3504
|
if (counters.errors >= ERROR_BUDGET)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.96",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bobfrankston/mailx-types": "^0.1.19",
|
|
13
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
13
|
+
"@bobfrankston/mailx-settings": "^0.1.28",
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.50",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.53",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.7",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.9",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
".transformedSnapshot": {
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bobfrankston/mailx-types": "^0.1.19",
|
|
41
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
41
|
+
"@bobfrankston/mailx-settings": "^0.1.28",
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.50",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.53",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.7",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.9",
|