Skip to content

fix: resolve #254: avoid double close calls while closing sockets #293

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

Closed
wants to merge 1 commit into from
Closed

Conversation

AdrianDC
Copy link
Contributor

@AdrianDC AdrianDC commented Feb 25, 2021

Upon long-term usage, I sometimes triggered segmentation faults due to an already freed / closed socket.

The on_fail and on_open functions need to handle the socket properly.

Test: I will use my patched version for a few days and confirm within next week.

C++ client : test.cpp
NodeJS server : test.js

docker run --rm -i -v "${PWD}:${PWD}" -w "${PWD}" centos:7.6.1810 <<EOF
# Dependencies
yum install -y cmake gcc gcc-c++ make openssl-devel psmisc
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
yum install -y nodejs
npm install socket.io

# Library
rm -rf ./build
mkdir -p ./build/
cd ./build/
cmake  ../
make install
cd ../

# Build
g++ -std=c++11 -Wall -lpthread -o test254 test.cpp /usr/local/lib*/libsioclient.a

# Test
{
  set +m;
  node ./test.js &
  time timeout -s9 10 ./test254
  killall node
}
EOF

@AdrianDC AdrianDC closed this by deleting the head repository Mar 22, 2023
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

Successfully merging this pull request may close these issues.

1 participant