sqlite-worker: OOM

Hi,

I am load testing and have noticed that the following happens when a row containing a single 1.3MB blob is written:

RuntimeError: memory access out of bounds
RuntimeError: table index is out of bounds
    at sql-wasm.wasm:0x36f48
    at sql-wasm.wasm:0x4259e
    at sql-wasm.wasm:0xb8643
    at za (sql-wasm.wasm:0xfa419)
    at e._sqlite3_close_v2 (VM26073 sql-wasm.js:2791)
    at c.export (VM26073 sql-wasm.js:420)
    at index.js:103
    at new Promise (<anonymous>)
    at index.js:102

This is possible on other sqlite3 implementations so I wonder if there is anything that can be done to make it work here as well

Many thanks

Edit: I originally posted 8.4MB but then found it happens also with as little as 1.3MB. I know it doesn’t happen with 1MB, somewhere between 1MB and 1.3MB it hits a limit. This was tested on Chrome (Opera)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 31 (17 by maintainers)

Most upvoted comments

Nice one! Tested and it works great

Thanks man, you too have a nice weekend wherever you are. Thanks again for your help. One fringe type of query wrongly used double quotes for one field… that is now everywhere so need to account for that

I am sure you could improve it 😉 but mortals need to live with what “just works”

I think the hex field needs something special)

I’ve no idea what’s the X field there but it’s clearly not part of my helper, as I wrote that in a minute and it surely doesn’t cover the world … you can improve that though 👋

Rule of thumbs (last comment from my side):

  • should I always use the template literal way with interpolations within it for values? Yes
  • should I avoid at all costs passing concatenated strings or any SQL that contains strings as value within the statement? Also Yes.

Like I’ve said, there is not a single use case for not using ? when values are meant … there’s no maybe, there’s no statement, if you have a value, the value should never be there, a ? should be there instead.