Skip to content

[Node] fix /app/octobots browser memory leak - #3653

Open
Herklos wants to merge 1 commit into
devfrom
fix/try-fix-memory-leak
Open

[Node] fix /app/octobots browser memory leak#3653
Herklos wants to merge 1 commit into
devfrom
fix/try-fix-memory-leak

Conversation

@Herklos

@Herklos Herklos commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Try to fix #3647

openDB() in device-key.ts never closed its IDBDatabase, and OpenAPI.PASSWORD
is resolved on every API request, so each call leaked two open connections
(one in idbLoadRecord, one in getOrCreateDeviceKey). On /app/octobots, which
polled GET /tasks every 2s, that was roughly 3600 leaked connections per hour.

- device-key.ts: memoise one connection per tab, reset on onclose/onversionchange.
  Cache the device CryptoKey and the decrypted password in memory; clearPassword()
  drops the cache first so clearAuth() and the 401 interceptor still invalidate.
- task-queries.ts: poll at 5s, stop polling in hidden tabs.
- BotCard.tsx: replace the per-poll JSON.stringify comparison with a reference
  fast path plus a field-by-field execution compare.
- GET /tasks: add include_content (default false). Task.content is a verbatim
  copy of the active execution's actions, already present in executions, and
  read nowhere in the UI. Ownership checks pass include_content=False.
- workflows_util: stray print on every unparseable workflow row to logger.debug.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Herklos
Herklos requested a review from GuillaumeDSM as a code owner August 23, 2026 16:47

@GuillaumeDSM GuillaumeDSM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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

Successfully merging this pull request may close these issues.

2 participants