Giter VIP home page Giter VIP logo

Comments (7)

quolpr avatar quolpr commented on May 29, 2024 1

I tried here quolpr@7c0d9bd , but it didn't help. I suspect that this error is about JS VM stack error 🤔

from wa-sqlite.

quolpr avatar quolpr commented on May 29, 2024 1

This isn't a valid SQL(ite) statement, right? Not that it should produce a stack overflow, but I'm wondering if that is part of what triggers the issue.

Nope, it's valid. You can run it with not asyncify build, or you can also paste it to here https://sql.js.org/examples/GUI/ . For me, it even fails with 1...100 range (in the example I used 1...200 VALUES).

I used VALUES in one of my queries and now instead I use CTE like here https://til.simonwillison.net/sqlite/cte-values

from wa-sqlite.

rhashimoto avatar rhashimoto commented on May 29, 2024 1

I'm going to mark this WONTFIX. I don't see a compelling reason to use nested VALUES in this way causing the deep recursion here. And unfortunately, even if there is a good reason to do this, the "obvious" ways that Emscripten provides to tune the stack size don't seem to have any effect.

from wa-sqlite.

rhashimoto avatar rhashimoto commented on May 29, 2024

Can you try:

Then rebuild the WASM artifacts. You would need to follow the build instructions on the README. If you don't have the time or the background, I'll get around to it at some point.

from wa-sqlite.

quolpr avatar quolpr commented on May 29, 2024

I also made the debug build, and it seems just fail to parse the query:

image

image

The bad things about this are that for iOS Safari it seems the stack size is not so big and sometime prepare fails even for simple query like CREATE TABLE ....

And yeah, the weird thing is that the first run doesn't fail 🤔

from wa-sqlite.

rhashimoto avatar rhashimoto commented on May 29, 2024

Thanks for taking a look! I'm puzzled because I really thought one of those changes would fix it. I'll investigate myself when I can.

This isn't a valid SQL(ite) statement, right? Not that it should produce a stack overflow, but I'm wondering if that is part of what triggers the issue.

from wa-sqlite.

rhashimoto avatar rhashimoto commented on May 29, 2024

Thanks, I never knew you could use a bare VALUES clause as a statement. Is there a reason you need so many VALUES, as opposed to just:

VALUES (0), (1), (2), ...

The internal functions sqlite3Select() and multiSelect() are mutually recursive, as your debug build stack trace shows, and every VALUES starts a new subquery and introduces another level of recursion.

I think that explains why you're putting so much pressure on the stack, though it doesn't explain why it won't fail on the first try or with dev tools open.

from wa-sqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.