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

Node process crashes (question) #102

Open
mreis1 opened this issue Apr 14, 2020 · 3 comments
Open

Node process crashes (question) #102

mreis1 opened this issue Apr 14, 2020 · 3 comments

Comments

@mreis1
Copy link

mreis1 commented Apr 14, 2020

Hello @xdenser.
I hope you are doing well.

Recently I started noticing mysterious process crashes on my app (in 1 hour i had 2/3 process crashes). Do you think this might be related with this lib?

Normally, when the crash takes place, only db operations are taking place but attempting to reproduce the same steps that were taking place before the process crash doesn't necessary lead us to reproduce the error.

As far as I know it, it seems completely random.
Hope you can point em in the right direction.

Thank you

PID 22123 received SIGSEGV for address: 0x20
0   segfault-handler.node               0x0000000104f5a070 _ZL16segfault_handleriP9__siginfoPv + 304
1   libsystem_platform.dylib            0x00007fff67e0442d _sigtramp + 29
2   ???                                 0x0000000000000001 0x0 + 1
3   node                                0x00000001009b26d2 uv__work_done + 178
4   node                                0x00000001009b5cc3 uv__async_io + 317
5   node                                0x00000001009c60fb uv__io_poll + 1934
6   node                                0x00000001009b6139 uv_run + 315
7   node                                0x0000000100044831 _ZN4node5StartEPN2v87IsolateEPNS_11IsolateDataERKNSt3__16vectorINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENSA_ISC_EEEESG_ + 976
8   node                                0x0000000100043d3c _ZN4node5StartEP9uv_loop_sRKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_ + 326
9   node                                0x0000000100043886 _ZN4node5StartEiPPc + 740
10  node                                0x0000000100001034 start + 52
11  ???                                 0x0000000000000002 0x0 + 2
@mreis1
Copy link
Author

mreis1 commented Apr 25, 2020

node v10.20.1
firebird (3.0.5)

var fb = require('firebird');
var con = fb.createConnection();
var fs = require('fs');
var SegfaultHandler = require('segfault-handler');
var password = process.env['FB_PASSWORD'];
var user = process.env['FB_USER'];
var db = '192.168.0.195/3050:C:\\_MARCIO_DEV\\04_databases\\TEST_DB.fdb'
var extendCon = require('./util');
console.log(extendCon)

SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name

con.connect(db, user, password,'', function(err){
	console.log(err ? 'Error' : 'Success');
	console.log(err);
	
	if (err) return ;
	extendCon(con);

	let promStack = [
		con.queryP('SELECT * FROM CLIENTS')
	];

	Promise.all(promStack)
		.then((qresList) => {
			return qresList[0].fetchAllP();
		})
		.then((rows) => {
			console.log(rows);
			con.commitSync();
		})
		.catch((err) => {
			console.log('Err ', err);
			con.rollbackSync();
		})
		.finally(() => {
			console.log('Disconnecting')
			setTimeout(() => {
				con.disconnect();
				console.log('Disconnected')


				/**
				Without the setTimeout below, a segfault is thrown
				PID 6686 received SIGSEGV for address: 0x59e0
				0   segfault-handler.node               0x0000000102f72050 _ZL16segfault_handleriP9__siginfoPv + 304
				1   libsystem_platform.dylib            0x00007fff7425042d _sigtramp + 29
				2   node                                0x00000001018dfa0c _ZL12utrace_level + 153020
				3   node                                0x000000010000d68c _ZN4node16EmitAsyncDestroyEPN2v87IsolateENS_13async_contextE + 29
				4   libsystem_c.dylib                   0x00007fff740fb446 __cxa_finalize_ranges + 319
				5   libsystem_c.dylib                   0x00007fff740fb71c exit + 55
				6   node                                0x000000010000103b start + 59
				7   ???                                 0x0000000000000002 0x0 + 2
				Segmentation fault: 11
				*/
				setTimeout(() => {
					console.log('Process exit');
					process.exit(0);
				},1000)
			},4000)
		})	
});

@mreis1
Copy link
Author

mreis1 commented Apr 27, 2020

Here are some additional conclusions from my recent tests.
Same program on all tests.

At certain point in my app, there was a query that was generating a SQL error (for example Invalid FK). What I expect, is an error to be thrown but the process would stay alive.

Here's the test results:
Mac: Firebird 0.1.3 - App stays alive
Mac: Firebird 0.1.4 - App stays alive
Win64: Firebird 0.1.4 - Process exits mysteriously
Win64: Firebird 0.1.3 - then I replaced [email protected] by a [email protected] and the app works

@mreis1
Copy link
Author

mreis1 commented Jul 30, 2020

I came up with a similar error in version 0.1.3 although it happens less often than with version 0.1.4.
Most of time I get a crash, the server is processing multiple parallel HTTP requests.

In my last crash I was running some stress testing on my http server with autocannon.

The latest error I had:
PID 23887 received SIGSEGV for address: 0x127
0 segfault-handler.node 0x0000000107f1d040 _ZL16segfault_handleriP9__siginfoPv + 304
1 libsystem_platform.dylib 0x00007fff67e2642d _sigtramp + 29
2 ??? 0x00002a97ef5826f1 0x0 + 46832043960049
3 node 0x00000001009dffac uv__work_done + 176
4 node 0x00000001009e3531 uv__async_io + 294
5 node 0x00000001009f2d36 uv__io_poll + 1665
6 node 0x00000001009e396a uv_run + 359
7 node 0x0000000100041c00 ZN4node5StartEPN2v87IsolateEPNS_11IsolateDataERKNSt3__16vectorINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENSA_ISC_EEEESG + 946
8 node 0x0000000100040cc2 ZN4node5StartEP9uv_loop_sRKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD + 329
9 node 0x0000000100040984 _ZN4node5StartEiPPc + 681
10 node 0x0000000100001034 start + 52

Full crash log available here : https://paste.itefix.net/?b71e7c351d5531ae#5K6t2PSffFwfAan996SX1AADEkPiwRnDwe8nXCSi9iGX

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

1 participant