E273 Tell users what happens when the Wasm memory runs out, and how to avoid it by dominion525 · Pull Request #185 · dominion525/jetdb · GitHub
[go: up one dir, main page]

Skip to content

Tell users what happens when the Wasm memory runs out, and how to avoid it - #185

Merged
dominion525 merged 1 commit into
mainfrom
docs/wasm-out-of-memory
Oct 26, 2026
Merged

dominion525 merged 1 commit into
mainfrom
docs/wasm-out-of-memory

Conversation

@dominion525
Copy link
Copy Markdown
Owner

Summary

  • The memory of the Wasm module cannot grow past 4 GiB. When a call needs more, it throws a RuntimeError (unreachable in Node.js), not a JetdbError, and nothing is logged.
  • When it happens inside a method of a Database, later calls and free() of that Database throw and its memory is not released, so the module should be loaded again. This was reproduced on Node.js; other open Databases kept working.
  • The way to avoid it is to read large tables in parts with the limit and start options of rows, and to free each Database or open it with using rather than leave it to the garbage collector.
  • docs/wasm (English and Japanese) has a new section on it, and the README of jetdb-wasm a summary in its limitations.

🤖 Generated with Claude Code

@github-actions
github-actions Bot commented Oct 26, 2026 •
Copy link
Copy Markdown

Coverage

For 7acd76f.

Filename                       Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
jetdb-cli/src/export.rs            144                11    92.36%           9                 1    88.89%          72                 5    93.06%           0                 0         -
jetdb-cli/src/form.rs              248                19    92.34%          25                 5    80.00%         156                 6    96.15%           0                 0         -
jetdb-cli/src/macro_cmd.rs         120                11    90.83%           7                 2    71.43%          63                 4    93.65%           0                 0         -
jetdb-cli/src/main.rs              948                30    96.84%          83                 3    96.39%         597                21    96.48%           0                 0         -
jetdb-cli/src/prop.rs              390                20    94.87%          44                 2    95.45%         228                 9    96.05%           0                 0         -
jetdb-cli/src/query.rs              64                 3    95.31%           5                 0   100.00%          32                 0   100.00%           0                 0         -
jetdb-cli/src/vba.rs                58                 3    94.83%           5                 0   100.00%          28                 0   100.00%           0                 0         -
jetdb-wasm/src/lib.rs             3919               103    97.37%         257                 4    98.44%        2066                29    98.60%           0                 0         -
jetdb/src/catalog.rs               509                14    97.25%          46                 0   100.00%         299                 3    99.00%           0                 0         -
jetdb/src/complex.rs               924                32    96.54%          73                 0   100.00%         605                15    97.52%           0                 0         -
jetdb/src/crypto.rs               2300               112    95.13%         127                10    92.13%        1315                60    95.44%           0                 0         -
jetdb/src/csv.rs                   974                13    98.67%          77                 0   100.00%         557                 3    99.46%           0                 0         -
jetdb/src/data.rs                 4798                89    98.15%         299                 3    99.00%        2701                50    98.15%           0                 0         -
jetdb/src/ddl/access.rs             70                 0   100.00%           7                 0   100.00%          46                 0   100.00%           0                 0         -
jetdb/src/ddl/mod.rs              2771                 8    99.71%         208                 2    99.04%        1501                 6    99.60%           0                 0         -
jetdb/src/ddl/mysql.rs              70                 0   100.00%           7                 0   100.00%          46                 0   100.00%           0                 0         -
jetdb/src/ddl/postgres.rs           71                 0   100.00%           7                 0   100.00%          46                 0   100.00%           0                 0         -
jetdb/src/ddl/sqlite.rs             69                 0   100.00%           7                 0   100.00%          48                 0   100.00%           0                 0         -
jetdb/src/encoding.rs              284                 0   100.00%          30                 0   100.00%         153                 0   100.00%           0                 0         -
jetdb/src/file.rs                 1932                64    96.69%         118                 0   100.00%         989                18    98.18%           0                 0         -
jetdb/src/form.rs                 3332               133    96.01%         248                11    95.56%        1780                50    97.19%           0                 0         -
jetdb/src/form2000.rs              934                20    97.86%          73                 1    98.63%         497                 4    99.20%           0                 0         -
jetdb/src/format.rs                616                 2    99.68%          45                 0   100.00%         388                 2    99.48%           0                 0         -
jetdb/src/lib.rs                    10                 3    70.00%           1                 0   100.00%           7                 2    71.43%           0                 0         -
jetdb/src/macro_action.rs          299                19    93.65%          27                 3    88.89%         165                24    85.45%           0                 0         -
jetdb/src/macro_def.rs            2440                88    96.39%         196                 9    95.41%        1596                36    97.74%           0                 0         -
jetdb/src/macro_text.rs            804                24    97.01%          54                 2    96.30%         451                20    95.57%           0                 0         -
jetdb/src/map.rs                   416                13    96.88%          27                 0   100.00%         221                 5    97.74%           0                 0         -
jetdb/src/money.rs                 296                 0   100.00%          28                 0   100.00%         190                 0   100.00%           0                 0         -
jetdb/src/prop.rs                 1375                18    98.69%          90                 0   100.00%         695                10    98.56%           0                 0         -
jetdb/src/query.rs                2514                62    97.53%         200                 1    99.50%        1550                18    98.84%           0                 0         -
jetdb/src/relationship.rs          249                26    89.56%          22                 0   100.00%         177                10    94.35%           0                 0         -
jetdb/src/save_as_text.rs          574                27    95.30%          52                 3    94.23%         341                27    92.08%           0                 0         -
jetdb/src/storage.rs               766                32    95.82%          57                 0   100.00%         435                 6    98.62%           0                 0         -
jetdb/src/table.rs                1679                65    96.13%         109                 2    98.17%        1017                17    98.33%           0                 0         -
jetdb/src/timestamp.rs             491                 0   100.00%          51                 0   100.00%         285                 0   100.00%           0                 0         -
jetdb/src/vba.rs                   949                57    93.99%          82                11    86.59%         540                21    96.11%           0                 0         -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                            38407              1121    97.08%        2803                75    97.32%       21883               481    97.80%           0                 0         -

…id it

- Describe the error a caller sees, a RuntimeError rather than a JetdbError, with nothing logged
- Describe that the Database whose method ran out cannot be used or freed after it, and that the module should be loaded again
- Describe how to avoid it: read large tables in parts, and free databases or open them with using
- Add a section to docs/wasm in English and Japanese, and a summary to the README of jetdb-wasm

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dominion525
dominion525 force-pushed the docs/wasm-out-of-memory branch from c257b16 to 7acd76f Compare October 26, 2026 18:19
@dominion525
dominion525 merged commit b097723 into main Oct 26, 2026
11 checks passed
@dominion525
dominion525 deleted the docs/wasm-out-of-memory branch October 26, 2026 18:29
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.

1 participant

0