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

Test fails on node.js 0.10 #126

Closed
ryukbk opened this issue Mar 13, 2013 · 18 comments
Closed

Test fails on node.js 0.10 #126

ryukbk opened this issue Mar 13, 2013 · 18 comments

Comments

@ryukbk
Copy link

ryukbk commented Mar 13, 2013

On Debian Linux 6.0.5 (x64) and node.js 0.10, make is ok but 'make test' fails at the beginning of the test.

*** glibc detected *** node: free(): corrupted unsorted chunks: 0x00000000022a0a20 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71bd6)[0x2b8eea6b4bd6]
/lib/libc.so.6(cfree+0x6c)[0x2b8eea6b994c]
/home/test/node-sqlite3/build/Release/node_sqlite3.node(_ZN5AsyncISsN12node_sqlite38DatabaseEE5closeEP11uv_handle_s+0x41)[0x2b8eea9bd851]
node(uv_run+0x20e)[0x6f359e]
node(_ZN4node5StartEiPPc+0x13d)[0x5b184d]
/lib/libc.so.6(__libc_start_main+0xfd)[0x2b8eea661c8d]
node[0x5a80a9]

[snip]

/bin/sh: line 1: 22792 Aborted NODE_PATH="./lib:" expresso -I lib test/*.test.js

@risacher
Copy link

make test fails for me on Ubuntu 12.04, x86_64, with node 0.10. In my case, test/support/createdb.js consumes all available memory until the OOM killer gets it. 2G memory in the system, freshly booted. If I reduce the number of rows inserted into big.db to 1e6, then it fails thusly:

    ◦ retrieve 100,000 rows with Statement#each: *** glibc detected *** node: free(): corrupted unsorted chunks: 0x0000000001ef0000 ***
Segmentation fault (core dumped)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

I think this may be the same bug. Not sure. I re-ran under node 0.10.1 and got similar result, but this backtrace:

======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x2afa79049b96]
/home/magnus/node/jb/node_modules/node-sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement5BatonD0Ev+0xd7)[0x2afa7942f0a7]
/home/magnus/node/jb/node_modules/node-sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement8FinalizeEPNS0_5BatonE+0x31)[0x2afa7942b8f1]
/home/magnus/node/jb/node_modules/node-sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement7ProcessEv+0x57)[0x2afa7942b9a7]
/home/magnus/node/jb/node_modules/node-sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement14Work_AfterEachEP9uv_work_s+0x49)[0x2afa7942c4b9]
node(uv__work_done+0xa1)[0x6d64d1]
node[0x6cc7b2]
node[0x6cc886]
node(uv__io_poll+0x1ae)[0x6d911e]
node(uv_run+0xd0)[0x6cd0b0]
node(_ZN4node5StartEiPPc+0x119)[0x58f2b9]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x2afa78fec76d]
node[0x584fe5]

@katanacrimson
Copy link

Probably related to #128, #127.

@ryukbk
Copy link
Author

ryukbk commented Apr 1, 2013

So something went wrong in Database::Work_Close
With the latest code in the repo that uses mocha, I got the following backtrace:


profiling
? should profile a create table
? should profile a select

rerunning statements
*** glibc detected *** node: free(): corrupted unsorted chunks: 0x00000000027b7510 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71bd6)[0x2b5b54cefbd6]
/lib/libc.so.6(cfree+0x6c)[0x2b5b54cf494c]
/home/test/node-sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite38Database5BatonD0Ev+0x4a)[0x2b5b54ff9a7a]
/home/test/node-sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite38Database15Work_AfterCloseEP9uv_work_s+0x23d)[0x2b5b54ff546d]
node(uv__work_done+0xa7)[0x6fc067]
node[0x6f2693]
node[0x6f2916]
node(uv__io_poll+0x21a)[0x6ff86a]
node(uv_run+0xd0)[0x6f3460]
node(_ZN4node5StartEiPPc+0x13d)[0x5b184d]
/lib/libc.so.6(__libc_start_main+0xfd)[0x2b5b54c9cc8d]
node[0x5a80a9]

@iammer
Copy link

iammer commented Apr 13, 2013

I am seeing this as well with node 0.10.4 and node-sqlite3 2.1.7.

@risacher
Copy link

@damianb I was not using npm, I was using source from GitHub. My report was not related to #127

@pkoretic
Copy link

pkoretic commented May 8, 2013

same here, using 0.10.4, 0.10.5, 0.11.2
downgrading node to 0.8.x resolves the problem with sqlite3 but that is barely a solution

@springmeyer
Copy link
Contributor

@pkoretic - can you try node-sqlite3 from master and see if that works? If not an you post the errors exactly? Its running fine for me on ubuntu precise (though a few tests are failing).

@pkoretic
Copy link

pkoretic commented May 8, 2013

I've just compiled it from master. Now I only got 'Segmentation fault (core dumped)' (after I've done two selects on database with two tables and 3 rows).

@springmeyer
Copy link
Contributor

@pkoretic - this is running the existing mocha tests, or with a custom script? If the latter, please post it here.

@pkoretic
Copy link

pkoretic commented May 8, 2013

.schema gives

CREATE TABLE list(ID INTEGER PRIMARY KEY NOT NULL, name TEXT, valid NUMBER);

select * from list gives

 
1|test1|1
2|test2|2
3|test3|3

script part is:

  response.writeHead(200, { "Content-Type" : "application/json"});
  var db = new sqlite3.Database("database.db", sqlite3.OPEN_READONLY);
  var data = [];                                                
  db.each("SELECT ID, name, desc FROM list", function(error, row) 
  {   
      if(!error)
      data.push({ID : row.ID, NAME : row.name,  DESC : row.desc});
  },  
  function()
  {   
      db.close();
      response.end(JSON.stringify(data));    
  });

Doing few requests one after another breaks it. As I've said, using 0.8.x version of nodejs works fine.

@ryukbk
Copy link
Author

ryukbk commented May 13, 2013

With node.js 0.10.5 (Debian Linux 6.0.5 (x64) ) and the latest node-sqlite3 code from the repo, the test fails at another point.

Creating test database... This may take several minutes.
npm test

sqlite3@2.1.7-alpha pretest /home/test/node-sqlite3
make db

make[1]: Entering directory /home/test/node-sqlite3' okay: database already created make[1]: Leaving directory/home/test/node-sqlite3'

sqlite3@2.1.7-alpha test /home/test/node-sqlite3
mocha -R spec --timeout 10000

query properties
? should return the correct lastID (55ms)
? should return the correct changes count

blob
? should insert blobs
? should retrieve the blobs (40ms)

cache
? should cache Database objects while opening
? should cache Database objects after they are open

constants
? should have the right OPEN_* flags
? should have the right error flags

error handling
? throw when calling Database() without new
? should error when calling Database#get on a missing table
? Database#all prepare fail
? Database#run prepare fail
? Database#each prepare fail
? Database#each prepare fail without completion handler
? Database#get prepare fail with param binding
? Database#all prepare fail with param binding
? Database#run prepare fail with param binding
? Database#each prepare fail with param binding
? Database#each prepare fail with param binding without completion handler

each
? retrieve 100,000 rows with Statement#each: *** glibc detected *** node: free(): corrupted unsorted chunks: 0x00000000013113d0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71e16)[0x2b6674bffe16]
/lib/libc.so.6(cfree+0x6c)[0x2b6674c04b8c]
/home/test/node-sqlite3/lib/node_sqlite3.node(sqlite3_free+0x6e)[0x2b6674f152de]
/home/test/node-sqlite3/lib/node_sqlite3.node(+0x2e982)[0x2b6674f21982]
/home/test/node-sqlite3/lib/node_sqlite3.node(+0x2e9f4)[0x2b6674f219f4]
/home/test/node-sqlite3/lib/node_sqlite3.node(+0x5b92c)[0x2b6674f4e92c]
/home/test/node-sqlite3/lib/node_sqlite3.node(sqlite3_finalize+0x37)[0x2b6674f4eb67]
/home/test/node-sqlite3/lib/node_sqlite3.node(_ZN12node_sqlite39Statement8FinalizeEv+0x1c)[0x2b6674f0ba5c]
/home/test/node-sqlite3/lib/node_sqlite3.node(_ZN12node_sqlite39Statement8FinalizeEPNS0_5BatonE+0x12)[0x2b6674f0bab2]
/home/test/node-sqlite3/lib/node_sqlite3.node(_ZN12node_sqlite39Statement7ProcessEv+0x57)[0x2b6674f0b7d7]
/home/test/node-sqlite3/lib/node_sqlite3.node(_ZN12node_sqlite39Statement14Work_AfterEachEP9uv_work_s+0x56)[0x2b6674f0b9c6]
node(uv__work_done+0xa7)[0x6fbb47]
node[0x6f2163]
node[0x6f23e6]
node(uv__io_poll+0x21a)[0x6ff1ba]
node(uv_run+0xd0)[0x6f2f30]
node(_ZN4node5StartEiPPc+0x13d)[0x5b1afd]
/lib/libc.so.6(__libc_start_main+0xfd)[0x2b6674bacc8d]
node[0x5a8229]

@ryukbk
Copy link
Author

ryukbk commented May 24, 2013

Also fails on node 0.8.9 ( #142 )

@cdanea
Copy link

cdanea commented May 24, 2013

same problem on Ubuntu 12.04.2 LTS,
node@0.10.7
sqlite3@2.1.7

var tables = [],
                expected = 'authors,books,sqlite_sequence,books_authors_link,books_languages_link,books_plugin_data,books_publishers_link,books_ratings_link,books_series_link'+
'books_tags_link,comments,conversion_options,custom_columns,data,feeds,identifiers,languages,library_id,metadata_dirtied,preferences,publishers,ratings,series,tags,sqlite_stat1'.split(',');
            calibreDatabase.each(
                "select name from sqlite_master where type='table'",
                function(err, row) {tables.push(row.name);},
                function() {console.log(tables);done&&done();}
            );

/*
[ 'authors',
  'books',
  'sqlite_sequence',
  'books_authors_link',
  'books_languages_link',
  'books_plugin_data',
  'books_publishers_link',
  'books_ratings_link',
  'books_series_link',
  'books_tags_link',
  'comments',
  'conversion_options',
  'custom_columns',
  'data',
  'feeds',
  'identifiers',
  'languages',
  'library_id',
  'metadata_dirtied',
  'preferences',
  'publishers',
  'ratings',
  'series',
  'tags',
  'sqlite_stat1' ]
Segmentation fault (core dumped)
*/
// in mocha i get the array, then:
*** glibc detected *** node: free(): corrupted unsorted chunks: 0x0000000000e8d500 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f9858d92b96]
/home/ciprian/workbench/calibre/node_modules/sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement5BatonD0Ev+0xd7)[0x7f985826d017]
/home/ciprian/workbench/calibre/node_modules/sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement8FinalizeEPNS0_5BatonE+0x31)[0x7f9858269861]
/home/ciprian/workbench/calibre/node_modules/sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement7ProcessEv+0x57)[0x7f9858269917]
/home/ciprian/workbench/calibre/node_modules/sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement14Work_AfterEachEP9uv_work_s+0x49)[0x7f985826a429]
node(uv__work_done+0xa1)[0x6d7201]
node[0x6cd532]
node[0x6cd606]
node(uv__io_poll+0x1ae)[0x6d9e5e]
node(uv_run+0xd0)[0x6cde30]
......
Aborted (core dumped)

@risacher
Copy link

I resolved by downgrading to node.js 0.8.22, which was the most recent version that worked for me on both Ubuntu 13.04 and 12.04.2.

(I think I tried node.js 0.8.23; not 100% sure.)

@barbogast
Copy link

I got the same segfault when running the example code from https://github.com/developmentseed/node-sqlite3. node v0.10.8, sqlit3 v2.1.7, Ubuntu 12.10, 64bit

@yandongliu
Copy link

Same error. Please fix.

@springmeyer
Copy link
Contributor

fixed by 25db957, the node-sqlite3 v2.1.8 tag now works with node v0.10.x

@grncdr
Copy link

grncdr commented Jun 13, 2013

Builds are passing for any-db again, awesome! 🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants