sql-js / sql-js/sql.js

out of memory

Ouverte
#568 9 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
JavaScript
Étoiles
13.7k
Forks
1.1k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

First off, my JavaScript environment is very custom and different than the web or Node.js. We are running in a wasm32-wasi environment with QuickJS, using wasmedge-quickjs, and Wasmtime on the Internet Computer.

That being said, the strange thing is that I had this working about a week ago, but now it doesn't work. We've been doing a lot of low-level changes to our JS environment (we're working at the engine/platform level), but I just don't understand what could have caused this.

The simple problem is that we get an error just trying to initialize the database: out of memory

Here's our code:

import { Server } from 'azle';
import express from 'express';
import initSqlJs from 'sql.js/dist/sql-asm.js';

export default Server(async () => {
    const SQL = await initSqlJs({
        locateFile: (filename) => `/dist/${filename}`
    });

    const db = new SQL.Database();

    const app = express();

    app.get('/', (req, res) => {
        res.send('Hello world');
    });

    return app.listen();
});

We have to use asm as our environment does not have a Wasm interpreter. I've tried sql-asm-memory-growth.js as well and I get the same error. I've even gone back multiple versions to maybe 1.7.0 and the error is always there.

Any ideas on what could cause this? I've also tried adding:

            TOTAL_STACK: 4_000_000_000,
            TOTAL_MEMORY: 4_000_000_000,
            FAST_MEMORY: 4_000_000_000

to the initSqlJs options.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Start by reproducing initialization in the described wasm32-wasi environment, using sql-asm.js and then sql-asm-memory-growth.js. Trace initSqlJs through new SQL.Database() and compare the behavior across the mentioned versions and memory options. Done means identifying a reproducible cause or documenting the environment limitation and a confirmed workaround.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
express, javascript, sqlite, typescript, wasm
Domaine
databases
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.