question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Random core dumps on AWS Lambda 10.x

See original GitHub issue

Hi,

I’m running node-libcurl on AWS Lambda Node.js 10.x and I’m getting random core dumps. So, one request completes completely normal once and then the next time it fails with a dump.

There errors come in two parts:

  1. Some illegal pointer exception.
llpropertylink-mainview\":free(): invalid pointer

or

free(): invalid pointer
  1. The default core dump message
Runtime exited with error: signal: aborted (core dumped)
Runtime.ExitError

I compile node_libcurl.node using a Docker container called lambci/lambda:build-nodejs10.x and just copy the resulting binary to the zip used to deploy to Lambda.

Using some debug statements, I can see that the end or error event are not emitted when there is a dump. The last thing in the logs is the curl.perform() method being called.

The weird thing is, outside of these core dumps, it works perfectly for 90%-95% of all requests.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
JCMaiscommented, Jun 23, 2019

@tnolet I have taken a closer look into this issue today, and the main problem is that the prebuilt addon is not compatible with Amazon Linux. I had no time to investigate further why that happens. The solution is to rebuild the addon directly.

The good news is that I’ve made some adjustments to the build script that is used to create the prebuilt binaries so you can use it more easily. Here are the steps you need to take to build it yourself (those steps are based on the repository you posted above, https://github.com/JCMais/node-libcurl/issues/176#issuecomment-502446705):

  1. Remove the Dockerfile since we are not going to need a separated docker image
  2. Run:
docker run --rm -it -v "$PWD":/var/task --entrypoint /bin/bash lambci/lambda:build-nodejs10.x
  1. Inside the container, run the following commands sequentially:
# needed to retrieve dependencies
yum install wget
# yarn is used on the build script instead of npm
#  it will give an error, but just need to export the PATH with the yarn dirs added
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# retrieve this repository, we need to checkout develop because the adjustments are only there for now
#  there are no changes currently besides that one, so it's safe to use (you probably want to checkout some specific commit tho).
git clone https://github.com/JCMais/node-libcurl.git && cd node-libcurl && git checkout develop && cd ..
# built the addon statically with all their dependencies (this can take a few minutes)
PUBLISH_BINARY=false GIT_TAG="" GIT_COMMIT="" STOP_ON_INSTALL=true PREFIX_DIR="/var/task" ./node-libcurl/scripts/ci/build.sh
# we are done
exit
  1. Now you can just run the script you created: ./run.sh https

It worked here, I’ve run it 100 times and it succeeds on all of them.

1reaction
tnoletcommented, Jul 11, 2019

This seems to be fixed when building a dedicated binary using the dev branch or commit 4a1bde612318d3374c19c56883965fe8d43e5e77

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reducing Java cold starts on AWS Lambda functions with ...
The following chart reflects invoking the sample application Lambda function 100 times per second for 10 minutes. This test is based on this ......
Read more >
Solved - AWS Lambda, Segmentation Fault (Core Dumped)
I recently discovered that a couple lambda functions were not failing properly. These lambda functions were configured to send messages to a ...
Read more >
aws lambda php runtime sporatically core dumps
To me, a core dump indicates a PHP run-time failure due any number of issues like a double free or memory out of...
Read more >
Serverless Distributed Decision Forests with AWS Lambda
handler(): the function that will be called by AWS Lambda. In the handler, we're passing down a random seed. This seed will be...
Read more >
Resolving Segmentation Fault (“Core dumped”) in Ubuntu - Blog
You may do backtracking or debugging to resolve it but the solution is to repair the broken packages and we can do it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found