Commit Graph

3491 Commits

Author SHA1 Message Date
Nathan Wallace
481e055bbc Fix #4819: Add certificate backup before rotation 2025-11-15 10:51:42 -05:00
Nathan Wallace
4ce3372867 Unskip test demonstrating bug #4819: Certificate rotation without backup 2025-11-15 10:51:42 -05:00
Nathan Wallace
1a1b380918 Concurrent read and close synchronization closes #4805 (#4874)
* Unskip test demonstrating bug #4805: Concurrent read and close may race

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix #4805: Add synchronization for concurrent StreamRow and Close

The sync.Once in Close() only prevents multiple Close() calls, but
doesn't coordinate with StreamRow() operations. Added a mutex and
closed flag to prevent race conditions when one goroutine streams
rows while another closes the result.

The fix:
- Added mutex (mu) and closed flag to Result struct
- StreamRow checks closed flag before streaming (with RLock)
- Close sets closed flag (with Lock) before closing channel

This prevents "send on closed channel" panics and data races.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-15 10:51:37 -05:00
Nathan Wallace
6016a71053 Nil pointer dereference in logReceiveError closes #4798 (#4842)
* Unskip test demonstrating bug #4798: Nil pointer dereference in logReceiveError

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix #4798: Add nil check to logReceiveError

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-15 10:50:17 -05:00
Nathan Wallace
e278975448 RunBatchSession nil Client handling closes #4796 (#4839)
* Unskip test demonstrating bug #4796: RunBatchSession panics with nil Client

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix #4796: Add nil check for Client in RunBatchSession

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-15 10:49:31 -05:00
Nathan Wallace
22bfc9991f initialisationComplete flag synchronized closes #4803 (rebased) (#4886)
* Add test for #4803: Race condition in initialisationComplete flag

Add TestInitialisationComplete_RaceCondition to demonstrate the data race
that occurs when the initialisationComplete boolean flag is accessed
concurrently by multiple goroutines without synchronization.

The test simulates:
- Init goroutine writing to the flag
- Query executor reading via isInitialised()
- Notification handler reading the flag directly

This test will fail when run with the -race flag, exposing the bug.

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix #4803: Use atomic.Bool for initialisationComplete flag

Replace the plain boolean initialisationComplete field with atomic.Bool
to prevent data races when accessed concurrently by multiple goroutines.

Changes:
- Change field type from bool to atomic.Bool
- Use .Store(true) for writes
- Use .Load() for reads in isInitialised() and handleConnectionUpdateNotification()
- Update test to use atomic operations

The test now passes with -race flag, confirming the race condition is fixed.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-15 10:48:46 -05:00
Nathan Wallace
7a1533bd4f Race condition in rate limiter map access closes #4799 (#4843)
* Add test for #4799: Race condition in rate limiter map access

This test demonstrates the race condition in getUserDefinedLimitersForPlugin
where the userLimiters map is read without mutex protection while being
concurrently written by other goroutines.

Run with: go test -race -v -run TestPluginManager_ConcurrentRateLimiterMapAccess ./pkg/pluginmanager_service

* Fix #4799: Add mutex protection for rate limiter map access

Protected all accesses to m.userLimiters map with RWMutex:
- getUserDefinedLimitersForPlugin: Added RLock for map read
- getPluginsWithChangedLimiters: Added RLock for map iteration
- handleUserLimiterChanges: Added Lock for map write
- refreshRateLimiterTable: Added RLock for map iteration
- setRateLimiters: Added RLock for map read

This prevents data races when the map is concurrently read and written
by multiple goroutines.
2025-11-15 10:48:09 -05:00
Nathan Wallace
a4d90c3ac9 Fix logic error in IdentifyMissingComments closes #4814 (#4872)
* Add test for #4814: Logic error in IdentifyMissingComments

Demonstrates the bug where the function uses OR (||) instead of AND (&&)
on line 426, causing connections being deleted to be incorrectly added
to MissingComments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix #4814: Change OR to AND in IdentifyMissingComments logic

Corrects the logic error on line 426 where OR (||) was incorrectly used
instead of AND (&&). The condition should be "if NOT updating AND NOT
deleting" to properly exclude connections being updated or deleted from
the MissingComments list.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-15 08:10:53 -05:00
Nathan Wallace
cb1fa48173 Fix flaky TestQueryContextLeakage test (#4887)
Changes:
1. Renamed TestQueryContextLeakage -> TestContextCancellationTiming
   - The test was checking cancellation timing, not memory leaks
   - Updated comments to reflect actual purpose

2. Increased timeout from 1ms to 100ms
   - 1ms is too aggressive for CI runners under load
   - 100ms still catches real deadlocks while avoiding flakiness
   - Added detailed comments explaining the timeout choice

3. Added TestNoGoroutineLeaks using goleak
   - Properly tests for actual resource leaks (goroutines)
   - More reliable than memory-based leak detection
   - Uses industry-standard goleak library

The original 1ms timeout caused intermittent CI failures on slower
runners, as context cancellation involves goroutine scheduling that
has no guaranteed sub-millisecond timing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-15 08:05:00 -05:00
Nathan Wallace
2e5f3fda97 Add comprehensive passing tests from bug hunting initiative (#4864) 2025-11-13 09:26:46 +08:00
Nathan Wallace
aaef09b670 Fix #4866: Increase snapshot row streaming timeout from 5s to 30s (#4867) 2025-11-13 09:14:46 +08:00
dependabot[bot]
4e84c29348 [dep][actions](deps): Bump golangci/golangci-lint-action (#4766) 2025-11-11 19:26:16 +08:00
Nathan Wallace
5c11d66574 Fix #4699: Add bounds check to isValidDatabaseName (#4733) 2025-11-11 19:25:44 +08:00
Nathan Wallace
5e1d316759 Fix #4710: Return empty slice instead of nil in getTableAndConnectionSuggestions (#4734) 2025-11-11 19:25:03 +08:00
Nathan Wallace
8baad08f41 Fix #4718: Use atomic write to prevent partial files (#4740) 2025-11-11 19:06:13 +08:00
Nathan Wallace
688e711419 Add AI development documentation and guidelines (#4777) 2025-11-11 19:03:27 +08:00
Nathan Wallace
a7cb5caa02 Fix #4715: Add mutex protection to export.Manager (#4738) 2025-11-11 18:54:52 +08:00
Nathan Wallace
7996d3c878 Fix #4712: Make Result.Close() idempotent (#4741) 2025-11-11 18:53:18 +08:00
Nathan Wallace
99fd81ccf6 Fix memory leak in DatabaseSession management (issue #3737) (#4742) 2025-11-11 18:35:16 +08:00
Nathan Wallace
6ebc0e5040 Fix #4744: Race condition on spinner.Suffix field (#4772) 2025-11-11 18:01:56 +08:00
Nathan Wallace
da0c9ddc0e Fix #4750: Nil pointer panic in RegisterExporters (#4769) 2025-11-11 17:58:06 +08:00
Nathan Wallace
28fb1d5237 Fix #4767: GetDbClient error handling (#4770) 2025-11-11 17:54:56 +08:00
Nathan Wallace
1472e96e74 Fix #4748: SQL injection vulnerability in GetSetConnectionStateSql (#4773) 2025-11-11 17:39:46 +08:00
Nathan Wallace
ca32de335c Fix #4757: Race condition in exemplarSchemaMap (#4774) 2025-11-11 17:31:58 +08:00
Nathan Wallace
aa696c9da3 Fix #4756: Race condition in Viper global state (#4775) 2025-11-11 17:29:59 +08:00
Nathan Wallace
13a24f840f Fix #4768: Goroutine leak in snapshot (#4776) 2025-11-11 17:26:33 +08:00
Nathan Wallace
4281ad3f10 Add comprehensive tests for pkg/{task,snapshot,cmdconfig,statushooks,introspection,initialisation,ociinstaller} (#4765) 2025-11-11 17:02:49 +08:00
Puskar Basu
d943ddd23a Merge branch 'v2.3.x' into develop (#4694) 2025-11-03 14:51:09 +05:30
Puskar Basu
b41fbe31d9 v2.3.2 v2.3.2 2025-11-03 14:21:51 +05:30
Puskar Basu
603ae82e6e Fix glibc errors in linux builds (#4692) 2025-11-03 13:49:19 +05:30
Puskar Basu
248a1f4936 Merge branch 'v2.3.x' into develop 2025-10-31 17:19:23 +05:30
Puskar Basu
119d7dd315 v2.3.1 v2.3.1 2025-10-31 16:36:45 +05:30
Puskar Basu
6367945009 Fix issue where macOS binaries failed to run due to absolute openssl paths and too-new min OS (#4687) 2025-10-31 16:20:33 +05:30
Puskar Basu
c69748b6be Merge branch 'v2.3.x' into develop 2025-10-30 15:43:20 +05:30
Puskar Basu
bc1003bebf v2.3.0 v2.3.0 2025-10-30 15:01:16 +05:30
Puskar Basu
9aac94322c Improve table truncation message for datasets exceeding 10k rows, show the same message in batch queries as well (#4675) 2025-10-30 13:47:07 +05:30
dependabot[bot]
d7289b85fd [dep][go](deps): Bump github.com/jackc/pgx/v5 from 5.7.3 to 5.7.6 (#4660) 2025-10-30 11:55:15 +05:30
dependabot[bot]
4fad14407b [dep][go](deps): Bump github.com/hashicorp/go-plugin from 1.6.3 to 1.7.0 (#4662) 2025-10-30 11:54:53 +05:30
dependabot[bot]
df135bf1f9 [dep][go](deps): Bump github.com/spf13/cobra from 1.9.1 to 1.10.1 (#4659) 2025-10-30 11:42:43 +05:30
dependabot[bot]
4b51cd8efc [dep][actions](deps): Bump actions/setup-go from 5.5.0 to 6.0.0 (#4663) 2025-10-30 11:41:43 +05:30
dependabot[bot]
b04eaa8e43 [dep][actions](deps): Bump actions/cache from 4.2.4 to 4.3.0 (#4664) 2025-10-30 11:41:22 +05:30
dependabot[bot]
f397a47a24 [dep][actions](deps): Bump actions/checkout from 4.2.2 to 5.0.0 (#4666) 2025-10-30 11:41:02 +05:30
dependabot[bot]
1e3253a9c8 [dep][actions](deps): Bump docker/login-action from 3.5.0 to 3.6.0 (#4667) 2025-10-30 11:40:39 +05:30
dependabot[bot]
d7c380ffc1 [dep][actions](deps): Bump actions/stale from 9.1.0 to 10.1.0 (#4669) 2025-10-30 11:40:18 +05:30
dependabot[bot]
856cbce572 [dep][go](deps): Bump github.com/jedib0t/go-pretty/v6 (#4672) 2025-10-30 11:39:57 +05:30
Puskar Basu
2fa696b2db Update embedded postgresql version to 14.19 (#4671) 2025-10-29 22:00:25 +05:30
kaidaguerre
294421c707 Merge pull request #4655 from turbot/v2.2.x
Merge branch 'v2.2.x' into develop
2025-09-24 13:39:17 +01:00
Puskar Basu
71017322e2 update changelog v2.2.0 2025-09-24 16:31:36 +05:30
Puskar Basu
2262010347 v2.2.0 v2.2.0 2025-09-24 15:25:35 +05:30
Puskar Basu
1670b1b264 FDW v2.1.3 2025-09-24 13:01:48 +05:30