Skip to content

Fix/rpc connection timeout#600

Open
Sundriveauto wants to merge 7 commits intoLabsCrypt:mainfrom
Sundriveauto:fix/rpc-connection-timeout
Open

Fix/rpc connection timeout#600
Sundriveauto wants to merge 7 commits intoLabsCrypt:mainfrom
Sundriveauto:fix/rpc-connection-timeout

Conversation

@Sundriveauto
Copy link
Copy Markdown
Contributor

Closed #473

Backend Stellar RPC calls in sorobanService.ts use the SDK's default 30-second transaction timeout but do not configure socket-level connection timeouts. If the RPC node is slow or hangs after accepting the connection, the request never times out and the caller waits indefinitely. This can exhaust the Node.js event loop and cause all subsequent requests to queue up.

@ogazboiz pls review Pr

Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RPC timeout implementation is a good fix. Two things before this can merge:

1. Remove .kiro/settings/lsp.json
This is an IDE settings file from the Kiro editor and should not be in the repo:

git rm -r .kiro/
echo '.kiro/' >> .gitignore
git commit -m 'chore: remove Kiro IDE settings, add to gitignore'

2. CI needs approval
Push the fix above and a maintainer will approve the CI run.

@ogazboiz
Copy link
Copy Markdown
Contributor

The codebase issues on main have been resolved and all CI checks are passing now. Please rebase your branch to pull in the latest changes before continuing. Thanks for your patience.

@Sundriveauto
Copy link
Copy Markdown
Contributor Author

@ogazboiz Pls review Pr

Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed a .kiro/settings/lsp.json editor config file, remove it. Massive package-lock.json noise from npm version mismatch. The timeout tests don't actually test the real fetchWithTimeout function. The rpcCall wrapper on the last line has an unclosed parenthesis. Fix and trigger CI.

- Add fetchWithTimeout in stellar.ts and inject it into rpc.Server so
  every SDK HTTP call (getAccount, prepareTransaction, sendTransaction,
  getHealth, pollTransaction) is subject to a hard 15-second abort.
- Wrap all server.* calls in sorobanService.ts with rpcCall() which
  converts AbortError into a clean AppError.internal timeout message.
- Add two tests to stellarConfig.test.ts covering signal injection and
  abort-on-timeout behaviour.
@Sundriveauto Sundriveauto force-pushed the fix/rpc-connection-timeout branch from 8641266 to 430c126 Compare March 31, 2026 03:14
@Sundriveauto
Copy link
Copy Markdown
Contributor Author

@ogazboiz pls review

@ogazboiz
Copy link
Copy Markdown
Contributor

All four feedback items addressed, nice work. The diff is clean now. One thing: CI hasn't run on this branch. Push an empty commit to trigger it: git commit --allow-empty -m 'trigger CI' && git push

@Sundriveauto
Copy link
Copy Markdown
Contributor Author

@ogazboiz review

@ogazboiz
Copy link
Copy Markdown
Contributor

heads up, a few important changes just landed on main that affect your PR:

  1. axios pinned to 1.13.5 - there's an active supply chain attack on axios 1.14.1 (pulls in confirmed malware). we added overrides in all package.json files to block it.

  2. CI now runs a supply chain audit before backend/frontend jobs. if your lockfile has a compromised package, CI will fail with a clear error.

  3. backend test fixes - loanEndpoints tests now use valid Stellar addresses and base64 strings. if your PR was failing backend CI but you didn't touch backend code, this should fix it after rebase.

please rebase on latest main:

git fetch upstream
git rebase upstream/main
git push --force-with-lease

@Sundriveauto
Copy link
Copy Markdown
Contributor Author

@ogazboiz rebase done

Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @Sundriveauto, the RPC timeout with AbortController is a solid fix. the fetchWithTimeout wrapper and tests look good. merging!

if you want to keep contributing or follow up on open issues, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

@ogazboiz
Copy link
Copy Markdown
Contributor

ogazboiz commented Apr 2, 2026

hey @Sundriveauto, approved and ready to merge but there's a small conflict now (likely .gitignore overlap with #601 which just merged). quick rebase should fix it:

git fetch upstream
git rebase upstream/main
git push --force-with-lease

will merge as soon as it's clean.

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.

fix(backend): Stellar RPC calls have no socket-level timeout causing event loop starvation

2 participants