asfernandes / node-firebird-drivers

Node.js Firebird Drivers
MIT License
53 stars 17 forks source link

Errors with exceptions when the addon is built with VS 2017/2019 #9

Closed sywka closed 5 years ago

sywka commented 5 years ago

Description

Instead of generating a javascript error on some machines, the process ends in an error For example connection to a non-existent database:

it("Windows; Error code: 3221226505", async () => {
        const options: CreateDatabaseOptions = {
            username: "SYSDBA",
            password: "masterkey"
        };
        const client = createNativeClient(getDefaultLibraryFilename());
        try {
            const attachment = await client.connect(
                "localhost/3050:C:/MAIN.FDB",
                options);
            await attachment.disconnect();
        } finally {
            await client.dispose();
        }
    });

This causes the completion of the process with exit code 3221226505. The same result with other methods of interaction with the database that should throw an error.

I could not understand whether the problem is in the environment settings. I can only say that a new user was created on the machine and a clean installation was made. Perhaps you can tell me where to look for the problem or if there is an error in the driver, then fix it.

Versions

OS: Windows 10 Firebird: 3.0.4 Node: 8.12.0 || 10.13.0 || 11.1.0 Yarn: 1.12.3 node-firebird-driver-native: 0.1.1

asfernandes commented 5 years ago

I had the same error running the tests in azure pipelines but was not able to identify yet.

gsbelarus commented 5 years ago

The weirdness of the error is that it surely depends on computer/environment. We have systems where it appears frequently and have systems where it doesn't appear at all. We tested with Node 8 - 10 - 11 -- all the same.

For sure we can say that error appears after a Firebird server returns error (wrong SQL query, attempt to create database over existing file etc).

We tried to increase node stack memory with --max-old-space-size option but it didn't help either.

As for first suggestion one could look for some memory allocation based on overflown integer variable. For example SIGNED INT buffer size variable treated like UNSIGNED etc. But it is only suggestion.

Also a recursion could be suspected.

Anyway we appreciated your work and made some small donation via PayPal.

Thanks a lot!

asfernandes commented 5 years ago

I think I have identified the problem. I am trying to better test the solution.

Many thanks for the donation! 😃

asfernandes commented 5 years ago

I do have the error only with VS 2017. I'm suspecting this compiler have a bug. When we throw exception the same library is not catching it before report to node.

gsbelarus commented 5 years ago

Ok. We will try windows-build-tools with --vs2015 switch and keep watching for some time. If it solves the problem then there is some problem/bug inside vs2017 itself or in a vs2017-code-to-node bridge.