{"action":"created","issue":{"url":"https://api.github.com/repos/JCMais/node-libcurl/issues/176","repository_url":"https://api.github.com/repos/JCMais/node-libcurl","labels_url":"https://api.github.com/repos/JCMais/node-libcurl/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/JCMais/node-libcurl/issues/176/comments","events_url":"https://api.github.com/repos/JCMais/node-libcurl/issues/176/events","html_url":"https://github.com/JCMais/node-libcurl/issues/176","id":454263549,"node_id":"MDU6SXNzdWU0NTQyNjM1NDk=","number":176,"title":"Random core dumps on AWS Lambda 10.x","user":{"login":"tnolet","id":3802923,"node_id":"MDQ6VXNlcjM4MDI5MjM=","avatar_url":"https://avatars3.githubusercontent.com/u/3802923?v=4","gravatar_id":"","url":"https://api.github.com/users/tnolet","html_url":"https://github.com/tnolet","followers_url":"https://api.github.com/users/tnolet/followers","following_url":"https://api.github.com/users/tnolet/following{/other_user}","gists_url":"https://api.github.com/users/tnolet/gists{/gist_id}","starred_url":"https://api.github.com/users/tnolet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tnolet/subscriptions","organizations_url":"https://api.github.com/users/tnolet/orgs","repos_url":"https://api.github.com/users/tnolet/repos","events_url":"https://api.github.com/users/tnolet/events{/privacy}","received_events_url":"https://api.github.com/users/tnolet/received_events","type":"User","site_admin":false},"labels":[{"id":322835252,"node_id":"MDU6TGFiZWwzMjI4MzUyNTI=","url":"https://api.github.com/repos/JCMais/node-libcurl/labels/segfault","name":"segfault","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2019-06-10T16:48:19Z","updated_at":"2019-06-23T21:03:43Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\n\r\nI'm running node-libcurl on AWS Lambda Node.js 10.x and I'm getting random core dumps.\r\nSo, one request completes completely normal once and then the next time it fails with a dump.\r\n\r\nThere errors come in two parts:\r\n1. Some illegal pointer exception.\r\n\r\n```\r\nllpropertylink-mainview\\\":free(): invalid pointer\r\n```\r\nor\r\n\r\n```\r\nfree(): invalid pointer\r\n```\r\n\r\n2. The default core dump message\r\n\r\n```\r\nRuntime exited with error: signal: aborted (core dumped)\r\nRuntime.ExitError\r\n```\r\nI 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.\r\n\r\nUsing 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.\r\n\r\nThe weird thing is, outside of these core dumps, it works perfectly for 90%-95% of all requests. "},"comment":{"url":"https://api.github.com/repos/JCMais/node-libcurl/issues/comments/504786923","html_url":"https://github.com/JCMais/node-libcurl/issues/176#issuecomment-504786923","issue_url":"https://api.github.com/repos/JCMais/node-libcurl/issues/176","id":504786923,"node_id":"MDEyOklzc3VlQ29tbWVudDUwNDc4NjkyMw==","user":{"login":"JCMais","id":1041647,"node_id":"MDQ6VXNlcjEwNDE2NDc=","avatar_url":"https://avatars1.githubusercontent.com/u/1041647?v=4","gravatar_id":"","url":"https://api.github.com/users/JCMais","html_url":"https://github.com/JCMais","followers_url":"https://api.github.com/users/JCMais/followers","following_url":"https://api.github.com/users/JCMais/following{/other_user}","gists_url":"https://api.github.com/users/JCMais/gists{/gist_id}","starred_url":"https://api.github.com/users/JCMais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JCMais/subscriptions","organizations_url":"https://api.github.com/users/JCMais/orgs","repos_url":"https://api.github.com/users/JCMais/repos","events_url":"https://api.github.com/users/JCMais/events{/privacy}","received_events_url":"https://api.github.com/users/JCMais/received_events","type":"User","site_admin":false},"created_at":"2019-06-23T21:03:43Z","updated_at":"2019-06-23T21:03:43Z","author_association":"OWNER","body":"@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.\r\n\r\nThe 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):\r\n\r\n1. Remove the Dockerfile since we are not going to need a separated docker image\r\n2. Run:\r\n```bash\r\ndocker run --rm -it -v \"$PWD\":/var/task --entrypoint /bin/bash lambci/lambda:build-nodejs10.x\r\n```bash\r\n3. Inside the container, run the following commands sequentially:\r\n```\r\n# needed to retrieve dependencies\r\nyum install wget\r\n# yarn is used on the build script instead of npm\r\n#  it will give an error, but just need to export the PATH with the yarn dirs added\r\ncurl -o- -L https://yarnpkg.com/install.sh | bash\r\nexport PATH=\"$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH\"\r\n# retrieve this repository, we need to checkout develop because the adjustments are only there for now\r\n#  there are no changes currently besides that one, so it's safe to use (you probably want to checkout some specific commit tho).\r\ngit clone https://github.com/JCMais/node-libcurl.git && cd node-libcurl && git checkout develop && cd ..\r\n# built the addon statically with all their dependencies (this can take a few minutes)\r\nPUBLISH_BINARY=false GIT_TAG=\"\" GIT_COMMIT=\"\" STOP_ON_INSTALL=true PREFIX_DIR=\"/var/task\" ./node-libcurl/scripts/ci/build.sh\r\n# we are done\r\nexit\r\n```\r\n4. Now you can just run the script you created: `./run.sh https`\r\n\r\nIt worked here, I've run it 100 times and it succeeds on all of them."}}
{"actor":{"display_login":"JCMais"}}