Skip to content

Question: Do we need any logic on shutdown? #17

@ceckoslab

Description

@ceckoslab

I have been playing with chdb-node a lot lately - exploring what can I do with the project. I am working on a proof of concept a local emulator of a cloud based datawarehouse.

I programmed a lot logic in a single index.js file and I was running and stopping the index.js a few times a day.

Today I got a strange error after is was trying to start again the index.js with recent changes:

Attempt 1:

[1]    91711 abort      node index.js

Attempt 2::

node(91807,0x174d13000) malloc: *** error for object 0x6000001f4180: pointer being freed was not allocated
node(91807,0x174d13000) malloc: *** set a breakpoint in malloc_error_break to debug
node(91807,0x17470f000) malloc: *** error for object 0x600003a968c0: pointer being freed was not allocated
node(91807,0x17470f000) malloc: *** set a breakpoint in malloc_error_break to debug

After deleting the chdb data folder everything started working fine.

Here comes the question:

We we need to do or can we do something on SIGINT and SIGTERM ? I suppose that there could be cases where we could cause data corruption if we do not stop properly chdb while chdb is still processing data.

For example I noticed this code fragment in another project that takes requests and writes them to file system:

  // Handle close event
  process
    .once("message", (msg) => {
      if (msg === "shutdown") {
        shutdown(server);
      }
    })
    .once("SIGINT", () => shutdown(server))
    .once("SIGTERM", () => shutdown(server));
}

Full source code here: https://github.com/Azure/Azurite/blob/76f626284e4b4b58b95065bb3c92351f30af7f3d/src/blob/main.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions