The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hello, I've had this weird issue where my node server would sometimes crash when executing a query. I've narrowed it down where it only crashes when my result set has null values.

Am I mistaken?

sqlanywhere_conn.connect(sqlanywhere_conn_params, function(){
  sqlanywhere_conn.exec("select * from some_table", function(err, result){
  // Does not reach code here when returning NULL values
  });
});

Thanks!

asked 15 May '14, 10:31

NeWbLt123's gravatar image

NeWbLt123
36115
accept rate: 0%


UPDATE: The SQL Anywhere node.js driver on NPM has now been updated with version 1.0.1 that now resolves this issue: https://www.npmjs.org/package/sqlanywhere

> npm update sqlanywhere
npm http GET https://registry.npmjs.org/sqlanywhere
npm http 200 https://registry.npmjs.org/sqlanywhere
npm http GET https://registry.npmjs.org/sqlanywhere/-/sqlanywhere-1.0.1.tgz
npm http 200 https://registry.npmjs.org/sqlanywhere/-/sqlanywhere-1.0.1.tgz

> sqlanywhere@1.0.1 install C:\vendor\nodejs\node_modules\sqlanywhere
> node build.js

Looking for binaries...
Binaries found! Install Complete!
sqlanywhere@1.0.1 node_modules\sqlanywhere

Hello,

I believe you are correct and this is a bug. I can reproduce the crash with the following code against the SQL Anywhere demo database:

var sqlanywhere = require('sqlanywhere');
var conn = sqlanywhere.createConnection();
var cstr = { Server : 'demo',
             UserID : 'DBA',
             Password : 'sql'
           };

conn.connect(cstr, function( err ) {
    if( err ) {
        console.log( err );
        return;
    } 
    console.log( "Connected!" );

    // This returns values
    conn.exec("select top 3 * from contacts where customerID is not null", function(err, result){
      if ( err ) {
        console.log( err );
        return;
      }
      console.log("Result (no nulls): ", result);
    });

    // This doesn't / crashes
    conn.exec("select top 3 * from contacts where customerID is null", function(err, result){
      if ( err ) {
        console.log( err );
        return;
      }
      console.log("Result (with nulls): ", result);
    });

    conn.disconnect( function( err ) {
        console.log( "Connection Closed" );
    });
});

I see the folowing output:

> node test.js
Connected!
Result (no nulls):  [ { ID: 1,
    Surname: 'Hildebrand',
    GivenName: 'Jane',
    Title: 'ma',
    Street: '280 Washington St.',
    City: 'Kanata',
    State: 'CA',
    Country: 'USA',
    PostalCode: '94608',
    Phone: '5105551309',
    Fax: '5105554209',
    CustomerID: 119 },
  { ID: 2,
    Surname: 'Simmon',
    GivenName: 'Larry',
    Title: 'sa',
    Street: '343 Granville St.',
    City: 'Kitchener',
    State: 'TX',
    Country: 'USA',
    PostalCode: '77079',
    Phone: '7135558960',
    Fax: '7135559265',
    CustomerID: 332 },
  { ID: 3,
    Surname: 'Critch',
    GivenName: 'Susan',
    Title: 'pd',
    Street: '457 Center St.',
    City: 'Yale',
    State: 'WY',
    Country: 'USA',
    PostalCode: '01923',
    Phone: '5085554829',
    Fax: '5085553025',
    CustomerID: 220 } ]

And the return code of the nodejs process is -1073740777.

I have opened CR #764049 to address this issue. Thank you for the bug report.

permanent link

answered 15 May '14, 14:11

Jeff%20Albion's gravatar image

Jeff Albion
10.7k171174
accept rate: 24%

edited 26 May '14, 13:09

Where can I track this issue? Any idea when this will be resolved? Thanks :)

(26 May '14, 08:53) NeWbLt123
Replies hidden

If you wish to report/track/receive immediate updates/request a fix for an issue, you must have a technical support contract.

We already have a fix for the issue, and we hope to have an update on the npm shortly. I'll update this thread once I see it published.

(26 May '14, 10:30) Jeff Albion
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×13

question asked: 15 May '14, 10:31

question was seen: 1,426 times

last updated: 26 May '14, 13:09