-
Notifications
You must be signed in to change notification settings - Fork 6
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The collector_test.sh script unconditionally overrides the LOCAL_COLLECTOR_PORT environment variable even when the configured port is available and not in use. This causes issues when users explicitly configure a specific port via environment files, as the script ignores the configured value and replaces it with any available port it finds.
To Reproduce
Affected versions: All versions with collector_test.sh
Steps to reproduce the behavior:
- Configure
LOCAL_COLLECTOR_PORT=50068in your environment file (e.g.,.env-mainnet-UNISWAPV2-ETH) - Run
./build.shwhich callscollector_test.sh - Observe that even though port 50068 is available, the script finds port 50051 and overwrites the env file
- The configured port preference is lost and replaced with the first available port in the range
Expected behavior
The script should respect explicitly configured LOCAL_COLLECTOR_PORT values and only search for alternative ports when the configured port is actually in use by another service.
Proposed Solution
Modify collector_test.sh to:
- Only search for alternative ports when the configured port is actually in use (has active connections)
- Reuse the existing port connectivity test results instead of duplicating the check
- Preserve explicitly configured ports when they are available
Caveats
- The fix maintains backward compatibility for cases where no port is configured
- Port conflict detection relies on the same connectivity testing methods already in use
- The script will still override ports when there are genuine conflicts
Additional context
- Issue occurs on macOS and likely other Unix-like systems
- Affects Docker-based deployments where port configuration is critical
- Related to collector service initialization in snapshotter-lite-v2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
