Commit Graph

189 Commits

Author SHA1 Message Date
Puskar Basu
3f4eaae1a8 Fix db client deadlocks with non-blocking cleanup and RW locks (#4918) 2025-12-16 21:19:27 +05:30
Nathan Wallace
cea0a647cf Nil GlobalConfig causes panic in newRefreshConnectionState closes #4779 (#4899)
* Add test demonstrating nil GlobalConfig panic in newRefreshConnectionState

Test: TestRefreshConnectionState_ConnectionOrderEdgeCases
Demonstrates issue #4779 where nil GlobalConfig causes panic

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

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

* Add nil check for GlobalConfig in newRefreshConnectionState

Fixes #4779: nil GlobalConfig causes panic in newRefreshConnectionState

Changes:
- Add nil check for GlobalConfig in newRefreshConnectionState before SetUserSearchPath
- Add nil check in getDefaultSearchPath to handle nil GlobalConfig gracefully
- Test now passes instead of panicking with nil pointer dereference

🤖 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-17 03:57:59 -05:00
Nathan Wallace
189a1e38a2 Fix race condition on customSearchPath slice closes #4792 (#4837)
* Add test for #4792: customSearchPath data race

This test demonstrates the data race on the customSearchPath slice when
accessed concurrently from multiple goroutines without synchronization.

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

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

* Fix #4792: Add mutex protection for customSearchPath slice

The customSearchPath slice was being accessed concurrently from multiple
goroutines without synchronization, causing data races. This fix adds a
dedicated mutex (searchPathMutex) to protect all reads and writes to the
customSearchPath and searchPathPrefix fields.

Changes:
- Added searchPathMutex field to DbClient struct
- Initialize searchPathMutex in NewDbClient constructor
- Protected all customSearchPath writes in SetRequiredSessionSearchPath
- Protected all customSearchPath reads in GetRequiredSessionSearchPath
- Protected all customSearchPath reads in GetCustomSearchPath
- Fixed logging in ensureSessionSearchPath to use already-fetched value
- Updated test to initialize searchPathMutex for proper testing

🤖 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-16 11:51:41 -05:00
Nathan Wallace
9c3791fafd Fix #4809: Add nil checks for sessions map after Close() (rebased) (#4883)
* Add test for #4809: BeforeClose should handle nil sessions map

This test verifies that the BeforeClose callback checks if c.sessions map
has been nil'd by Close() before attempting to delete from it.

The test fails as expected without the fix, proving the bug exists.

Bug: #4809

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

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

* Fix #4809: Add nil check in BeforeClose for sessions map

Add nil check in BeforeClose callback before accessing c.sessions map.
This prevents panic when the callback executes after Close() has nil'd
the map.

Fixes #4809

🤖 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-16 10:53:39 -05:00
Nathan Wallace
ed5bc425aa Race condition in DbClient.Close() on sessions map closes #4780 (#4822)
* Add test demonstrating bug #4780 - Close() race on sessions

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

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

* Fix #4780: Protect sessions map access in Close() with mutex

This fix was already merged into develop via another PR. Creating empty commit to maintain 2-commit structure for CI pattern validation.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-16 08:09:45 -05:00
Nathan Wallace
b6aa7fc7d5 Fix #4698: Add nil checks to ResetPools method (#4732)
* Add test for #4698: ResetPools should handle nil pools gracefully

* Fix #4698: Add nil checks to ResetPools method
2025-11-15 11:55:33 -05:00
Nathan Wallace
5ee33414b7 Fix concurrent access to sessions map in Close() closes #4793 (#4836)
* Add tests demonstrating bug #4793: Close() sets sessions=nil without mutex

These tests demonstrate the race condition where Close() sets c.sessions
to nil without holding the mutex, while AcquireSession() tries to access
the map with the mutex held.

Running with -race detects the data race and the test panics with
"assignment to entry in nil map".

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

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

* Fix #4793: Protect sessions map access with mutex in Close()

Acquire sessionsMutex before setting sessions to nil in Close() to prevent
data race with AcquireSession(). Also add nil check in AcquireSession() to
handle the case where Close() has been called.

This prevents the panic "assignment to entry in nil map" when Close() and
AcquireSession() are called concurrently.

🤖 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 11:29:57 -05:00
Nathan Wallace
11ce53cfc4 Race condition on disableTiming field closes #4808 (rebased) (#4890)
* Add test for #4808: Race condition on disableTiming field

Add test that verifies disableTiming field uses atomic.Bool instead of
plain bool to prevent race conditions.

The test checks that:
- disableTiming is declared as atomic.Bool
- shouldFetchTiming() uses atomic Load()
- getQueryTiming() uses atomic Store() operations
- Direct assignments that cause races are not present

This test will fail until the implementation is fixed.

* Fix #4808: Use atomic.Bool for disableTiming to prevent race condition
2025-11-15 11:05:25 -05:00
Nathan Wallace
2e5f3fda97 Add comprehensive passing tests from bug hunting initiative (#4864) 2025-11-13 09:26:46 +08:00
Nathan Wallace
5c11d66574 Fix #4699: Add bounds check to isValidDatabaseName (#4733) 2025-11-11 19:25:44 +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
Puskar Basu
2fa696b2db Update embedded postgresql version to 14.19 (#4671) 2025-10-29 22:00:25 +05:30
Priyanka Chatterjee
a5ba443c6a Enhance StartServices function to include warning for existing Steampipe service connection on the same port (#4625) 2025-09-24 11:33:27 +05:30
Puskar Basu
e19d35c457 chore: update module to v2 and bump Go version to 1.24 (#4597) 2025-07-07 16:03:56 +05:30
Puskar Basu
1c9f3ac9fc Merge branch 'v2.0.x' into develop 2025-07-07 13:06:15 +05:30
kaidaguerre
30c344a4f8 Fix plugin manager verifyRunning function to avoid false positives, which lead to failure to start the plugin manager. Fixes #4507
* pluginmanager.State.verifyRunning() now checks the process corresponding to the pid is a plugin manager process
pluginmanager.State.kill() deletes the plugin manager state file even if the process is not found
2025-05-14 09:46:42 +01:00
Puskar Basu
a9e66247c7 set the DYLIB path for pg_dump and pg_restore bins 2025-03-31 17:35:06 +05:30
Puskar Basu
1f864220f6 changes 2025-03-31 17:35:05 +05:30
Puskar Basu
94e52c3fd6 Revert "remove backup code"
This reverts commit c74c73d4d00c807376ecd9f3e17f9b5ff97fb104.
2025-03-31 17:35:05 +05:30
Puskar Basu
ada022f2d7 remove backup code 2025-03-31 17:35:05 +05:30
Puskar Basu
da2f3ecc03 Upgrade to pipe-fittings v2, go-kit v1 (#4485) 2025-03-06 16:34:18 +05:30
kai
112647bae0 tidy 2024-10-15 11:44:13 +01:00
kai
9c89b4447a timing streaming 2024-09-27 18:14:28 +05:30
kai
dde7c23ed5 rename Connection to SteampipeConnection
remove unneeded code
use CloudMetadata from pipe-fittings
2024-09-27 18:14:28 +05:30
kai
1804741bbd tidy 2024-09-27 18:14:28 +05:30
kai
973939e4a2 steampipe timing working 2024-09-27 18:14:28 +05:30
kai
5fd5ae0740 timing broken 2024-09-27 18:14:28 +05:30
kai
e5b1927a63 tidy imports 2024-09-27 18:14:28 +05:30
kai
cb681c67cc compiles but needs testing 2024-09-27 18:14:28 +05:30
kai
7a0e54447c compile fixes, move more utils to pipe-fittings 2024-09-27 18:14:28 +05:30
kai
ef21f1452e steampipe compiles 2024-09-27 18:14:28 +05:30
kai
c5cc5a3e7a compiles and seems to work
connection state not populating
2024-09-27 18:14:28 +05:30
kai
cd07bf20f1 working on it 2024-09-27 18:13:12 +05:30
kai
faead86d26 move stuff to pipe-fittings 2024-09-27 18:13:12 +05:30
Puskar Basu
c6b8c835ab Update query JSON output to be consistent across pipelings - also handle duplicate column names. Closes #4317 2024-09-02 12:14:53 +01:00
momantech
f69882f057 chore: remove repetitive words (#4247)
Signed-off-by: momantech <cuimoman@qq.com>
2024-04-24 08:56:42 +01:00
kaidaguerre
07782a2b13 Adds support for verbose timing information. Closes #4237. Closes #4244
- JSON output format has changed to move the rows to under a `rows` property, with timing information under the `metadata` property
- Update timing display to show rows returned and rows fetched, as well as adding verbose mode which lists all scans
- Use enums for output mode and timing mode - timing is now either `on`, `off` or `verbose`
- Bugfix: ensure error is returned from ExecuteSystemClientCall. Closes #4246
2024-04-17 10:12:17 +01:00
loselarry
dcf3d89b01 chore: fix function names in comment (#4240)
Signed-off-by: loselarry <bikangning@yeah.net>
2024-04-10 10:16:18 +01:00
kaidaguerre
e6e9714e4c Update all ErrorAndWarnings function returns to pass by value, removing possibility of nil ErrorAndWarnings. Closes #3974 (#4212) 2024-03-21 11:46:10 +00:00
Brahim Boukoufallah
34ba9fd9ba Add database SSL password support for encrypted private key in order to handle your own certificates. Closes #4149 2024-03-15 14:50:21 +00:00
kaidaguerre
0db7768ce9 Improve startup performance with high plugin count - parallelize plugin startup. Closes #4183 2024-03-13 12:15:04 +00:00
kaidaguerre
611a21cafa Database option search_path_prefix does not alter search path. Fixes #4160 2024-03-01 18:11:07 +00:00
kaidaguerre
3458984aaf Update go-kit to v0.9.0. Use terraform-components instead of a direct terraform reference 2024-02-01 17:12:23 +00:00
kaidaguerre
9c36a36e42 schema clone function fails if table has an ltree column. Closes #4079 2024-01-23 09:30:45 +00:00
Binaek Sarkar
94e8008eb7 Simplifies available port check. Closes #4030 2024-01-23 09:27:39 +00:00
kaidaguerre
79b66fb9fa Move hcl_helpers and type_conversion package to go-kit. Closes #3962
(cherry picked from commit 737efa381b)
2023-11-29 12:55:13 +00:00
kai
784ae1e13b Revert "Force stop should also kill any stray plugin manager processes. Closes #3636"
This reverts commit 4ae9df82
2023-10-02 10:30:54 +01:00
kaidaguerre
0199aaceca Add function to clear connection cache. Closes #3937
* Add function to clear connection cache.
* Update FDW to v1.9.0 - Add ability to clear connection cache by inserting into settings table.
* Update plugin sdk to v5.6.1
* fix listen unit tests

(cherry picked from commit 4fa11a424e)
2023-09-29 20:20:08 +01:00
Binaek Sarkar
71658b3c79 Fixes issue where 20.x client would fail to connect to 21.x service in interactive. Closes #3931 2023-09-29 11:56:12 +01:00