Skip to content

Commit

Permalink
Increase socket timeout to 30s (#642)
Browse files Browse the repository at this point in the history
* Increase socket timeout to 30s

* change keys

* rev vcpkg

* add autoconf and libtool

* add automake

* fix infinite telemetry shutdown loop
  • Loading branch information
MisterTea authored Jun 4, 2024
1 parent 271d2a6 commit 4c2038e
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get -y update; sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build libutempter-dev build-essential openssh-server protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev
command: sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get -y update; sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build libutempter-dev build-essential openssh-server protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libtool libtool-bin autoconf
- checkout
- run:
name: Set up ssh & known_hosts
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- run:
name: Install system dependencies
command: sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get -y update; sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build libutempter-dev build-essential openssh-server
command: sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get -y update; sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build libutempter-dev build-essential openssh-server libtool libtool-bin autoconf
- checkout
- run:
name: Set up ssh & known_hosts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ lcov
sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ lcov libtool libtool-bin autoconf
echo "Host localhost\n Port 2222\n\n" >> ~/.ssh/config
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-linux-codecov
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-linux-codecov-1
- name: Build
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -y curl zip unzip tar libssl-dev libcurl4-openssl-dev libunwind-dev git cmake ninja-build gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++ libtool libtool-bin autoconf
echo "Host localhost\n Port 2222\n\n" >> ~/.ssh/config
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-linux-${{ matrix.sanitize }}
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-linux-${{ matrix.sanitize }}-1
- name: Build with ubsan
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/mac_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake ninja; brew install protobuf libsodium
brew install cmake ninja; brew install protobuf libsodium automake autoconf libtool
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git submodule update --init --force --recursive
Expand All @@ -39,7 +39,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx-1
- name: Test with ubsan
Expand All @@ -65,7 +65,7 @@ jobs:
git submodule update --init --force --recursive
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake ninja; brew install protobuf libsodium
brew install cmake ninja; brew install protobuf libsodium automake autoconf libtool
# Restore both vcpkg and its artifacts from the GitHub cache service.
- name: Restore vcpkg and its artifacts.
Expand All @@ -84,7 +84,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx-1
- name: Test with asan
run: |
Expand All @@ -109,7 +109,7 @@ jobs:
git submodule update --init --force --recursive
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake ninja; brew install protobuf libsodium
brew install cmake ninja; brew install protobuf libsodium automake autoconf libtool
# Restore both vcpkg and its artifacts from the GitHub cache service.
- name: Restore vcpkg and its artifacts.
Expand All @@ -128,7 +128,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx-1
- name: Test with msan
run: |
Expand All @@ -153,7 +153,7 @@ jobs:
git submodule update --init --force --recursive
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew install cmake ninja; brew install protobuf libsodium
brew install cmake ninja; brew install protobuf libsodium automake autoconf libtool
# Restore both vcpkg and its artifacts from the GitHub cache service.
- name: Restore vcpkg and its artifacts.
Expand All @@ -172,7 +172,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-osx-1
- name: Test with tsan
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/novcpkg_build_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
libunwind-dev
if: matrix.os == 'ubuntu-latest'
- name: Install Dependencies (macOS)
run: brew update && brew install ninja cmake pkg-config curl openssl protobuf libsodium
run: brew update && brew install ninja cmake pkg-config curl openssl protobuf libsodium automake autoconf libtool
if: matrix.os == 'macos-latest'

- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/novcpkg_build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
libunwind-dev
if: matrix.os == 'ubuntu-latest'
- name: Install Dependencies (macOS)
run: brew update && brew install ninja cmake pkg-config curl openssl protobuf libsodium
run: brew update && brew install ninja cmake pkg-config curl openssl protobuf libsodium automake autoconf libtool
if: matrix.os == 'macos-latest'

- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/vcpkg_build_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: choco install -y ninja
if: matrix.os == 'windows-latest'
- name: Install Dependencies (macOS)
run: brew update && brew install ninja cmake
run: brew update && brew install ninja cmake automake autoconf libtool
if: matrix.os == 'macos-latest'

- uses: actions/checkout@v4
Expand All @@ -89,7 +89,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-2-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-${{ matrix.os }}-${{ matrix.gcc }}-master
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-${{ matrix.os }}-${{ matrix.gcc }}-master-1
- name: Show content of workspace after cache has been restored
run: find $RUNNER_WORKSPACE
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/vcpkg_build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: choco install -y ninja
if: matrix.os == 'windows-latest'
- name: Install Dependencies (macOS)
run: brew update && brew install ninja cmake
run: brew update && brew install ninja cmake automake autoconf libtool
if: matrix.os == 'macos-latest'

- uses: actions/checkout@v4
Expand All @@ -91,7 +91,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
et-2-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-${{ matrix.os }}-${{ matrix.gcc }}-release
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-${{ matrix.os }}-${{ matrix.gcc }}-release-1
- name: Show content of workspace after cache has been restored
run: find $RUNNER_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion external/vcpkg
Submodule vcpkg updated 3370 files
8 changes: 4 additions & 4 deletions src/base/SocketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include "base64.h"

namespace et {
#define SOCKET_DATA_TRANSFER_TIMEOUT (10)
#define SOCKET_DATA_TRANSFER_TIMEOUT (30)

void SocketHandler::readAll(int fd, void* buf, size_t count, bool timeout) {
time_t startTime = time(NULL);
size_t pos = 0;
while (pos < count) {
if (!waitOnSocketData(fd)) {
time_t currentTime = time(NULL);
if (timeout && currentTime > startTime + 10) {
if (timeout && currentTime > startTime + SOCKET_DATA_TRANSFER_TIMEOUT) {
throw std::runtime_error("Socket Timeout");
}
continue;
Expand Down Expand Up @@ -46,7 +46,7 @@ int SocketHandler::writeAllOrReturn(int fd, const void* buf, size_t count) {
time_t startTime = time(NULL);
while (pos < count) {
time_t currentTime = time(NULL);
if (currentTime > startTime + 10) {
if (currentTime > startTime + SOCKET_DATA_TRANSFER_TIMEOUT) {
return -1;
}
ssize_t bytesWritten = write(fd, ((const char*)buf) + pos, count - pos);
Expand Down Expand Up @@ -77,7 +77,7 @@ void SocketHandler::writeAllOrThrow(int fd, const void* buf, size_t count,
size_t pos = 0;
while (pos < count) {
time_t currentTime = time(NULL);
if (timeout && currentTime > startTime + 10) {
if (timeout && currentTime > startTime + SOCKET_DATA_TRANSFER_TIMEOUT) {
throw std::runtime_error("Socket Timeout");
}
ssize_t bytesWritten = write(fd, ((const char*)buf) + pos, count - pos);
Expand Down
1 change: 1 addition & 0 deletions src/terminal/TelemetryService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void shutdownTelemetry() {
if (TelemetryService::exists()) {
cerr << "Shutting down sentry" << endl;
auto ts = TelemetryService::get();
TelemetryService::destroy();
ts->shutdown();
}
}
Expand Down

0 comments on commit 4c2038e

Please sign in to comment.