Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested each invocation raises an Segmentation fault (core dumped) #1606

Closed
vit1251 opened this issue May 5, 2022 · 2 comments
Closed

Nested each invocation raises an Segmentation fault (core dumped) #1606

vit1251 opened this issue May 5, 2022 · 2 comments
Labels

Comments

@vit1251
Copy link

vit1251 commented May 5, 2022

Issue Summary

Using nested iteration on large tables raise an Seffalt:

db.each(query1, (err, row) => {
    db.each(query2, (err, row) => {
       // code here...
    });
})

Any solution?

Steps to Reproduce

  1. Write nested queryes with each request
  2. Execute code

Version

5.0.7

Node.js Version

16.15.0

How did you install the library?

npm i

@vit1251 vit1251 added the bug label May 5, 2022
@daniellockyer
Copy link
Member

I can reproduce this with the following:

const sqlite3 = require('./').verbose();
const db = new sqlite3.Database(':memory:');

db.serialize(() => {
    db.run("CREATE TABLE lorem (info TEXT)");

    const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
    for (let i = 0; i < 1; i++) {
        stmt.run("Ipsum " + i);
    }
    stmt.finalize();

    db.each("SELECT rowid AS id, info FROM lorem", (err, row) => {
        db.each("SELECT rowid AS id, info FROM lorem", (err, row) => {
            console.log('inner', err, row);
        });

        console.log(err, row);
    });
});

db.close();

On v5.0.6, I get the following output:

null { id: 1, info: 'Ipsum 0' }
inner Error: SQLITE_MISUSE: Database handle is closed
--> in Database#each('SELECT rowid AS id, info FROM lorem', [Function (anonymous)])
    at Statement.<anonymous> (/Users/neo/code/devops/node-sqlite3/a.js:14:12) {
  errno: 21,
  code: 'SQLITE_MISUSE',
  __augmented: true
} undefined

On v5.0.7, I get a segfault.

@daniellockyer
Copy link
Member

This should be fixed in v5.0.8 🙂

This was referenced May 6, 2022
renovate bot added a commit to sequelize/umzug that referenced this issue Aug 22, 2022
This PR contains the following updates:



Package
Change
Age
Adoption
Passing
Confidence
Type
Update




@types/jest
27.0.3 -> 27.5.2




devDependencies
minor


@types/lodash
4.14.178 -> 4.14.184




devDependencies
patch


@types/uuid
8.3.3 -> 8.3.4




devDependencies
patch


@types/verror
^1.10.5 -> 1.10.5




devDependencies
pin


jest (source)
27.4.5 -> 27.5.1




devDependencies
minor


np
7.6.0 -> 7.6.2




devDependencies
patch


prettier (source)
2.5.1 -> 2.7.1




devDependencies
minor


sqlite3
5.0.7 -> 5.0.8




devDependencies
patch


ts-jest
27.1.2 -> 27.1.5




devDependencies
patch


ts-node (source)
10.4.0 -> 10.9.1




devDependencies
minor


typescript (source)
4.6.2 -> 4.7.4




devDependencies
minor


verror
^1.10.0 -> 1.10.1




devDependencies
pin




Release Notes

facebook/jest
v27.5.1
Compare Source
Features

[jest-config] Support comments in JSON config file (#​12316)
[pretty-format] Expose ConvertAnsi plugin (#​12308)

Fixes

[expect] Add type definitions for asymmetric closeTo matcher (#​12304)
[jest-cli] Load binary via exported API (#​12315)
[jest-config] Replace jsonlint with parse-json (#​12316)
[jest-repl] Make module importable (#​12311 & #​12315)

Chore & Maintenance

[*] Avoid anonymous default exports (#​12313)

v27.5.0
Compare Source
Features

[expect] Add asymmetric matcher expect.closeTo (#​12243)
[jest-mock] Added mockFn.mock.lastCall to retrieve last argument (#​12285)

Fixes

[expect] Add a fix for .toHaveProperty('') (#​12251)
[jest-each, @&#8203;jest/globals] Allow passing ReadonlyArray type of a table to describe.each and test.each (#​12297)
[@jest/globals] Add missing options argument to jest.doMock typing (#​12292)
[jest-environment-node] Add atob and btoa (#​12269)
[jest-matcher-utils] Correct diff for expected asymmetric matchers (#​12264)
[jest-message-util] Fix .getTopFrame() (and toMatchInlineSnapshot()) with mjs files (#​12277)

Chore & Maintenance

[*] Update graceful-fs to ^4.2.9 (#​11749)

Performance

[jest-resolve] perf: skip error creation on not found stat calls (#​11749)

v27.4.7
Compare Source
Fixes

jest-config Add missing @babel/core dependency (#​12216)

v27.4.6
Compare Source
Fixes

[jest-environment-node] Add AbortSignal (#​12157)
[jest-environment-node] Add Missing node global performance (#​12002)
[jest-runtime] Handle missing mocked property (#​12213)
[@jest/transform] Update dependency package pirates to 4.0.4 (#​12002)

Performance

jest-config perf: only register ts-node once when loading TS config files (#​12160)



sindresorhus/np
v7.6.2
Compare Source

Work around npm bug with error reporting (#​645)  6c871f9

v7.6.1
Compare Source

Fix error "glob pattern string required" (#​616)  9cff6da
Fix "pattern is too long" error when running np (#​633)  20117a4



prettier/prettier
v2.7.1
Compare Source
diff
Keep useful empty lines in description (#​13013 by @​chimurai)


v2.7.0
Compare Source
"""
First line
Second Line
"""
type Person {
name: String
}
v2.6.2
Compare Source
diff
Fix LESS/SCSS format error (#​12536 by @​fisker)

// Input
.background-gradient(@&#8203;cut) {
    background: linear-gradient(
        to right,
        @&#8203;white 0%,
        @&#8203;white (@&#8203;cut - 0.01%),
        @&#8203;portal-background @&#8203;cut,
        @&#8203;portal-background 100%
    );
}

// Prettier 2.6.1
TypeError: Cannot read properties of undefined (reading 'endOffset')

// Prettier 2.6.2
.background-gradient(@&#8203;cut) {
  background: linear-gradient(
    to right,
    @&#8203;white 0%,
    @&#8203;white (@&#8203;cut - 0.01%),
    @&#8203;portal-background @&#8203;cut,
    @&#8203;portal-background 100%
  );
}
Update meriyah to fix several bugs (#​12567 by @​fisker, fixes in meriyah by @​3cp)
Fixes bugs when parsing following valid code:
foo(await bar());
const regex = /.*/ms;
const element = <p>{/w/.test(s)}</p>;
class A extends B {
  #privateMethod() {
    super.method();
  }
}
v2.6.1
Compare Source
diff
Ignore loglevel when printing information (#​12477 by @​fisker)


v2.6.0
Compare Source
prettier --loglevel silent --find-config-path index.js


mapbox/node-sqlite3
v5.0.8
Compare Source
What's Changed

Reverted TryGhost/node-sqlite3@5063367, which was causing a segfault with certain queries (TryGhost/node-sqlite3#1605 and TryGhost/node-sqlite3#1606)

Full Changelog: TryGhost/node-sqlite3@v5.0.7...v5.0.8


kulshekhar/ts-jest
v27.1.5
Compare Source
Bug Fixes

transformers use Array.sort in hoisting transformer (#​3498) (e400a6e), fixes #​3476

v27.1.4
Compare Source
Bug Fixes

compiler: revert #​3194 (#​3362) (2b7dffe), closes #​3272
remove esbuild from peer dependency (#​3360) (8c8c1ca), closes #​3346
support Babel config file with .cjs extension (#​3361) (5e5ac4a), closes #​3335

v27.1.3
Compare Source
Bug Fixes

compiler: update memory cache for compiler using received file content (#​3194) (e4d9541)



TypeStrong/ts-node
v10.9.1
Compare Source
Fixed

Workaround nodejs bug introduced in 18.6.0 (#​1838) @​cspotcode

Only affects projects on node >=18.6.0 using --esm
Older versions of node and projects without --esm are unaffected



https://github.com/TypeStrong/ts-node/milestone/18?closed=1
v10.9.0
Compare Source
Added

--project accepts path to a directory containing a tsconfig.json (#​1829, #​1830) @​cspotcode

previously it required an explicit filename


Added helpful error message when swc version is too old to support our configuration (#​1802) @​cspotcode
Added experimentalTsImportSpecifiers option which allows using voluntary .ts file extensions in import specifiers (undocumented except for API docs) (#​1815) @​cspotcode

Fixed

Fixed bug where child_process.fork() would erroneously execute the parent's entrypoint script, not the intended child script (#​1812, #​1814) @​devversion
Fixed support for jsx modes "react-jsx" and "react-jsxdev" in swc transpiler (#​1800, #​1802) @​cspotcode
Fixed support for import assertions in swc transpiler (#​1817, #​1802) @​cspotcode
Fixed bug where calling repl.evalCode() with code not ending in a newline would not update the typechecker accordingly (#​1764, #​1824) @​cspotcode

https://github.com/TypeStrong/ts-node/milestone/16?closed=1
v10.8.2
Compare Source
Fixed

Revert "Use file URL for source map paths" (#​1821) @​cspotcode

Fixes #​1790: ts-node 10.8.1 regression where nyc code coverage reports had incorrect paths
Fixes #​1797: ts-node 10.8.1 regression where breakpoints did not hit in VSCode debugging


Allow JSON imports in node 16.15 and up (#​1792) @​queengooborg

JSON imports were already supported in v17.5 and up
this change extends support to >=16.15.0,<17.0.0
These version ranges match vanilla node's support for JSON imports



https://github.com/TypeStrong/ts-node/milestone/15?closed=1
v10.8.1
Compare Source
Fixed

Fixed #​1769: source URLs in source map cache were malformed on Windows, affecting code coverage reports (#​1769, #​1771) @​PaperStrike
Fixed #​1778: typechecker was erronously resolving imports from ESM files as if they were from CJS files (#​1778, #​1782) @​cspotcode

https://github.com/TypeStrong/ts-node/milestone/14
v10.8.0
Compare Source
Questions about this release? Ask in the official discussion thread: #​1767
Added

Added support for module=NodeNext, module=Node16, .mts, .cts, .mjs, and .cjs file extensions (#​1414, #​1694, #​1744, #​1745, #​1727, #​1717, #​1753, #​1757) @​cspotcode

For best results, enable experimentalResolver (docs)
See TypeScript's official documentation: https://www.typescriptlang.org/docs/handbook/esm-node.html
enables mixed-mode projects with both ESM and CommonJS
enables all supported file extensions in TypeScript 4.7
Obeys package.json "type"


Added ability to include file extensions in CommonJS imports (#​1727, #​1753) @​cspotcode

Enables consistency with ESM, where file extensions are often mandatory


Resolves from emitted to source file extensions (#​1727, #​1753) @​cspotcode

Must enable experimentalResolver, will be enabled by default in a future version (docs)
Typechecker requires importing the emitted file extension; ts-node resolves correctly to the source file.  E.g. import "./foo.js" will execute foo.ts See also: TypeScript issue #​37582
If typechecking is disabled, you can also use source file extensions.  E.g. import "./foo.ts"


Added experimentalSpecifierResolution (#​1727, #​1753) @​cspotcode

the same as Node's --experimental-specifier-resolution (Node docs)
can also be specified in tsconfig.json for convenience, to avoid the CLI flag
allows omitting file extensions in ESM imports, plus a few other CommonJS-style conveniences


Adds diagnostics property to TSError, with array of TypeScript diagnostic objects from the compiler (API docs) (#​1705, #​1706) @​paulbrimicombe

Changed

Renames option experimentalResolverFeatures to experimentalResolver (docs) (#​1727) @​cspotcode
Internal change to ESM loader for compatibility with forthcoming node versions: returns shortCircuit: true (#​1714, #​1715) @​cspotcode
Performance: Optimize filesystem stat calls in ESM loader and new CommonJS resolver (#​1758, #​1759) @​cspotcode
Performance, maintenance: Upgrade source-mapper dependency "@​cspotcode/source-map-support"

Switches to "trace-mapping" for underlying source-map parsing (#​1729) @​cspotcode



Fixed

Fixed bug where REPL .type command was not showing any type information when using TypeScript nightly builds (#​1761, #​1762) @​cspotcode
Correctly suppress "Custom ESM Loaders" warning on newer node versions where the warning's prose changed (#​1701) @​cspotcode
Fixed REPL bug where function signatures could not be entered across multiple lines (#​1667, #​1677) @​d9k
REPL treats unparenthesized object literals as objects, instead of as block scopes (#​1697, #​1699) @​jhmaster2000
Fixed bug where preferTsExts combined with third-party transpiler hooks could disrupt nyc code coverage (#​1755) @​cspotcode
Fixed bug where file:// URLs in stack traces did not always use percent-encoding (#​1738, #​1726, #​1729) @​cspotcode
Fixed bug where v8-compile-cache-lib did not correctly unhook itself (#​1717, #​1718, #​1719) @​cspotcode

This internal dependency is used to speed up loading the TypeScript compiler



Docs

Many docs improvements (#​1682) @​cspotcode
Options page: each option its own linkable header w/usage example (#​1606) @​cspotcode
Categorize APIs in typedoc, make entrypoints more prominent (#​1456) @​cspotcode
Clarify that the shorthand for --project is -P, not -p (#​1731, #​1734) @​lobsterkatie
Add common ESM errors to Troubleshooting page (#​1607) @​cspotcode

https://github.com/TypeStrong/ts-node/milestone/12
v10.7.0
Compare Source
Questions about this release? Ask in the official discussion thread: #​1680
Added

Adds --esm flag, option, and ts-node-esm binary (#​1258, #​1655)

Enables full esm support; no need for --loader nor NODE_OPTIONS
Use shebang #!/usr/bin/env ts-node-esm, run ts-node --esm, or add to your tsconfig.json: "ts-node": {"esm": true}



Changed

Unflag ESM json modules on node >=17.5.0 (#​1661, #​1665) @​Jamesernator

no longer requires --experimental-json-modules


Lazy-load dependencies to improve startup responsiveness. (#​1676)

Fixed

Fixed bug where "compiler", "transpiler", and swc backend would not resolve relative to the tsconfig.json that declared them (#​1662, #​1655)

Enables reusable tsconfig.json shared via node module to include necessary dependencies



https://github.com/TypeStrong/ts-node/milestone/11
v10.6.0
Compare Source
Questions about this release? Ask in the official discussion thread: #​1666
Added

Adds workaround for extensionless entrypoints with ESM loader (#​1649, #​1654)

You can now combine tools such as mocha with --loader ts-node/esm, where previously node would throw [ERR_UNKNOWN_FILE_EXTENSION]
node has a bug where combining --loader with an extensionless entrypoint causes this error nodejs/node#​33226
Some tools, for example mocha, have an extensionless entrypoint. (source, source)
Combining NODE_OPTIONS=--loader ts-node/esm with these tools causes this error.  mochajs/mocha#​4645
node intends to fix this bug in a future release: nodejs/node#​41711
In the interim, we have implemented a workaround in ts-node.


Adds support for target "ES2022" in moduleTypes overrides (#​1650)

Fixed

Fixed bug where --swc and other third-party transpilers did not respect moduleTypes overrides (#​1651, #​1652, #​1660)
Fixed bug where node flags were not preserved correctly in process.execArgv (#​1657, #​1658)

This affected child_process.fork(), since it uses process.execArgv to create a similar child runtime.
With this fix, child_process.fork() will preserve both node flags and ts-node hooks.


Fixed compatibility TypeScript 4.7's API changes (#​1647, #​1648)

https://github.com/TypeStrong/ts-node/milestone/9
v10.5.0
Compare Source

Questions about this release? Ask in the official discussion thread: #​1634
Added

Eliminate "Emit Skipped" errors (#​693, #​1345, #​1629)

Avoids all "Emit Skipped" errors by performing a fallback transpileOnly-style transformation.
Does not affect typechecking.  Type errors are still detected and thrown.
Fallback has the same limitations as isolatedModules. This will only affect rare cases such as using const enums with preserveConstEnums disabled.
Fixes #​693


Graduate swc transpiler out of experimental; add swc: true convenience option (docs) (#​1487, #​1536, #​1613, #​1627)

"swc": true or --swc will use swc for faster execution
This feature is no longer marked "experimental."  Thank you to everyone who filed bugs!


swc transpiler attempts to load @swc/core or @swc/wasm dependencies from your project before falling-back to global installations (#​1613, #​1627)

global fallback only occurs when using a global installation of ts-node


Add support for TypeScript's traceResolution output (docs) (#​1128, #​1491) @​TheUnlocked
Support import assertions in ESM loader (docs) (#​1557, #​1558, #​1559, #​1573) @​Pokute, @​geigerzaehler

Allows importing JSON files from ESM with the requisite flag (docs)


ts-node -vvv also logs absolute paths to ts-node and typescript, to make it more obvious when you're accidentally using globally-installed versions (#​1323, #​1620)
Add swc target "es2022" (#​1535, #​1540)

When you have target es2022 in tsconfig, will use swc's es2022 target



Changed

Initialize TypeScript compiler before starting REPL prompt (#​1498) @​TheUnlocked

Improves responsiveness for first line of REPL input


Use v8-compile-cache-lib to load typescript

improves startup time (#​1339, #​1603)


Support both --camelCase and --hyphen-case for all CLI flags; update documentation to use --camelCase (#​1598, #​1599)

Not a breaking change; CLI continues to accept both forms


Make TSError diagnosticText property non-enumerable to prevent it from being logged below the stack (#​1632)

Fixed

Fix #​1538: REPL inputs fail to transpile via swc (#​1538, #​1541, #​1602)
Fix #​1478: REPL erroneously logged undefined for all inputs after the first when using swc transpiler (#​1478, #​1580, #​1602)
Fix #​1389: In --showConfig output, emit accurate moduleTypes paths resolved relative to the tsconfig.json which declared them (#​1389, #​1619)
Fix: Remove indentation from ts-node --help output (#​1597, #​1600)
Fix #​1425: Merged definitions correctly into tsconfig.schemastore-schema.json (#​1425, #​1618)
Fix: Allow disabling "use strict" emit in SWC transpiler (#​1531, #​1537)
Fix: Add missing ERR_UNKNOWN_FILE_EXTENSION constructor; was throwing ERR_UNKNOWN_FILE_EXTENSION is not a constructor (#​1562) @​bluelovers
Fix #​1565: entrypoint resolution failed on node v12.0.x and v12.1.x (#​1565, #​1566) @​davidmurdoch

Docs

Explain env -S flag for shebangs (docs) (#​1448, #​1545) @​sheeit, @​chee
Suggest skipIgnore when you want to compile files in node_modules (docs) (#​1553) @​webstrand
Fix typo in moduleTypes on options page (docs) (#​1630, #​1633)

Misc

Adds experimental experimentalResolverFeatures option, but it does not do anything yet (#​1514, #​1614)

https://github.com/TypeStrong/ts-node/milestone/4


Microsoft/TypeScript
v4.7.4
Compare Source
For release notes, check out the release announcement.
For the complete list of fixed issues, check out the

fixed issues query for Typescript 4.7.0 (Beta).
fixed issues query for Typescript 4.7.1 (RC).
fixed issues query for Typescript 4.7.2 (Stable).
fixed issues query for Typescript 4.7.3 (Stable).
fixed issues query for Typescript 4.7.4 (Stable).

Downloads are available on:

npm
Visual Studio 2022/2019 (Select new version in project options)
NuGet package

v4.7.3
Compare Source
For release notes, check out the release announcement.
For the complete list of fixed issues, check out the

fixed issues query for Typescript 4.7.0 (Beta).
fixed issues query for Typescript 4.7.1 (RC).
fixed issues query for Typescript 4.7.2 (Stable).
fixed issues query for Typescript 4.7.3 (Stable).

Downloads are available on:

npm
Visual Studio 2022/2019 (Select new version in project options)
NuGet package

v4.7.2
Compare Source
For release notes, check out the release announcement.
For the complete list of fixed issues, check out the

fixed issues query for Typescript 4.7.0 (Beta).
fixed issues query for Typescript 4.7.1 (RC).
fixed issues query for Typescript 4.7.2 (Stable).

Downloads are available on:

npm
Visual Studio 2022/2019 (Select new version in project options)
NuGet package

v4.6.4
Compare Source
This release includes a bug fix for text formatting on certain ranges, which was impacting Visual Studio users.
For the complete list of fixed issues, check out the

fixed issues query for Typescript 4.6.0 (Beta).
fixed issues query for Typescript 4.6.1 (RC).
fixed issues query for Typescript 4.6.2 (Stable).
fixed issues query for Typescript 4.6.3 (Stable).
fixed issues query for Typescript 4.6.4 (Stable).

Downloads are available on:

npm
Visual Studio 2022/2019 (Select new version in project options)
NuGet package

v4.6.3
Compare Source
This release includes fixes for

an incremental parsing bug caused by faulty error recovery logic
improved results from the TypeScript API's preProcessFile function

For the complete list of fixed issues, check out the

fixed issues query for Typescript 4.6.0 (Beta).
fixed issues query for Typescript 4.6.1 (RC).
fixed issues query for Typescript 4.6.2 (Stable).
fixed issues query for Typescript 4.6.3 (Stable).

Downloads are available on:

npm



Configuration
📅 Schedule: Branch creation - "before 3am on Monday" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


 If you want to rebase/retry this PR, click this checkbox.


This PR has been generated by Mend Renovate. View repository job log here.

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants