Closed astorm closed 2 years ago
It looks like our wrapper for the makeRequest
method can't handle an argument that's missing its parametersByName
property. This seems to be a legitimate use -- makeRequest
is capable of accepting an BulkLoad
object in addition to a Request
object
I have not, however, been able to reproduce the behavior of a BulkLoad object being passed into the connection object's makeRequest
method. It looks like the only place this happens in core tedious code is here
which is after tedious has generated the SQL for a bulk load. The code currently isn't organized in a way that makes "reproducing this fatal error under test" simple (especially without specific tedious knowledge).
Since this is a crasher I'm going to recommend a two phase approach
Phase 1: Get get out a quick patch that simply bails on instrumentation if the parameter if parametersByName
is missing
Phase 2: Take a more considered approach as to how we want to instrument bulk inserts and how best to mock out the various parts of tedious and the agent to do this
Draft PR with a quick fix -- https://github.com/elastic/apm-agent-nodejs/pull/1935
will reach out to customer/user to see if they can test this vs. their crasher.
Draft PR with a quick fix -- #1935
@astorm Perhaps we could close this now?
From: https://discuss.elastic.co/t/apm-agent-crashes-nodejs-after-reporting-exception-in-tedious-instrumentation-code/259851
Kibana version: 7.8.1 (flavor:default, type:docker)
Elasticsearch version: 7.8.1 (flavor:default, type:docker)
APM Server version: 7.8.1 (flavor:default, type:docker)
APM Agent language and version: Elastic-apm-node v3.9.0
NodeJs version: 12.16.2
Browser version: Not relevant as server side
Original install method (e.g. download page, yum, deb, from source, etc.) and version:
Fresh install or upgraded from other version? : Fresh install
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): Elastic-apm-node v3.9.0 crashes NodeJs running NestJs server after sending report due to exception in tedious instrumentation while executing bulk insert in MS.Sql DB Last log I get is Sending error to Elastic APM { id: '17a9b49682b3da680437918195822005' } NodeJs stopped just after that
NodeJs always stop due to the same error when the application execute the bulk. And, just in case you are wondering, it works just fine when APM agent is disabled.
Fortunately the error is sent to APM and can see the detail in Kibana We can see that root cause of the exception is an Null reference on the request params
Steps to reproduce: There is only one bulk insert in the all application so easy to spot Below is a code extract
Provide logs and/or server output (if relevant):
Exception stack trace
Environment NodeJs : v12.16.2 Extract of package.json