Commit Graph

79 Commits

Author SHA1 Message Date
Nathan Wallace
2a3233b319 executeQueries nil Client check closes #4797 (#4841)
* Add test for #4797: executeQueries doesn't check for nil Client

This test demonstrates that executeQueries panics with a nil pointer
dereference when Client is nil. The test currently fails with:

panic: runtime error: invalid memory address or nil pointer dereference

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

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

* Fix #4797: Add nil check for Client in executeQueries

Added a nil check at the start of executeQueries to prevent nil pointer
panics when Client is not initialized. Now returns an error message and
counts all queries as failures instead of crashing.

🤖 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:13:18 -05:00
Nathan Wallace
8915b7598b Fix #4781: RunBatchSession blocks forever if initData.Loaded never closes (#4826)
* Add test demonstrating bug #4781 - RunBatchSession blocks forever

Test currently skipped as it demonstrates the bug where RunBatchSession
blocks forever if initData.Loaded channel never closes, even when the
context is cancelled. This test will be unskipped after the bug is fixed.

Related to #4781

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

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

* Fix #4781: Add context cancellation check to RunBatchSession

Changes RunBatchSession to respect context cancellation when waiting for
initialization. Previously, the function would block forever on the
initData.Loaded channel if it never closed, even when the context was
cancelled. Now uses a select statement to also check ctx.Done().

Fixes #4781

🤖 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 12:49:13 -05:00
Nathan Wallace
69ce8bc38d RunBatchSession nil initData validation closes #4795 (#4838)
* Add test for #4795: RunBatchSession panics with nil initData

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

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

* Fix #4795: Add nil check to 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 11:33:15 -05:00
Nathan Wallace
a23583dd91 Query history memory leak - unbounded growth closes #4811 (#4859)
* Add test for #4811: query history should have bounded size

* Fix #4811: Enforce bounded size for query history

Add enforceLimit() helper that ensures history never exceeds HistorySize.
Call it from Get(), Push(), and load() to prevent unbounded memory growth
even when history is pre-populated from file or direct manipulation.
2025-11-15 11:22:31 -05:00
Nathan Wallace
992653937d WrapResult nil input handling closes #4804 (#4875)
* Unskip test demonstrating bug #4804: WrapResult nil input

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

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

* Fix #4804: WrapResult returns nil for nil input

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:19:00 -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
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
2e5f3fda97 Add comprehensive passing tests from bug hunting initiative (#4864) 2025-11-13 09:26:46 +08:00
Nathan Wallace
7996d3c878 Fix #4712: Make Result.Close() idempotent (#4741) 2025-11-11 18:53:18 +08:00
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
219c049eae Fix issue where steampipe was returning 0 exit code for API failures. Closes #4551 2025-06-04 15:25:26 +01:00
Puskar Basu
da2f3ecc03 Upgrade to pipe-fittings v2, go-kit v1 (#4485) 2025-03-06 16:34:18 +05:30
kaidaguerre
8a5aca8f77 Rename CloudMetadata to PipesMetadata, move to pipe-fittings pipes package 2024-10-16 15:48:14 +01:00
Puskar Basu
30cafd9d48 fix snapshot and output 2024-10-03 16:20:09 +05:30
kai
9c89b4447a timing streaming 2024-09-27 18:14:28 +05:30
kai
b679a42ec1 acc 2024-09-27 18:14:28 +05:30
Puskar Basu
a0aad42e67 comments 2024-09-27 18:14:28 +05:30
Puskar Basu
e9dfb2ad12 publish snapshot working 2024-09-27 18:14:28 +05:30
Puskar Basu
758a100215 finally working 2024-09-27 18:14:28 +05:30
Puskar Basu
0a836584e9 snapshot output and export working 2024-09-27 18:14:28 +05:30
Puskar Basu
d6cbe7ad6e working 1 2024-09-27 18:14:28 +05:30
Puskar Basu
9e713885e9 building 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
6efd1fd6b2 query display and query result moved to pipe fittings 2024-09-27 18:14:28 +05:30
kai
1aff2b4f97 remove unused display options 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
ef21f1452e steampipe compiles 2024-09-27 18:14:28 +05:30
kai
cd07bf20f1 working on it 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
Puskar Basu
cb313fbabe Fix query error message to not include internal function name. Closes #4335 (#4337) 2024-08-13 15:23:35 +05:30
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
kaidaguerre
1079ba7083 Fix growing memory usage following file watching events when running dashboard server. Closes #4150 2024-02-23 13:19:15 +00:00
kaidaguerre
08f49d843f For query command, load mod variables syncronously but the rest of mod async. Closes #4109 2024-02-02 15:03:31 +00:00
kaidaguerre
103d53f8e8 Fix setting dependency vars in var file. Fix UI freeze when prompting for workspace variables. Closes #4105 2024-02-01 13:53:21 +00:00
Binaek Sarkar
085e933ddf Maintain the order of execution when running multiple queries in batch mode. Closes #3728 2024-01-02 11:52:16 +00:00
Puskar Basu
01097a27e6 Warn users to not have mod.sp files in home directory. Closes #2321 2023-09-22 18:07:55 +01:00
Binaek Sarkar
a3a714d6cd Fixes issue where temporary tables are dropped in interactive prompt when pool connections are recycled. Closes #3359. Closes #3781 2023-09-06 16:46:40 +01:00
kaidaguerre
40804a3201 Execute RefreshConnections asyncronously and optimise for high connection count. Add connection_state table.
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents

 Closes #3394
 Closes #3267
2023-05-10 09:05:08 +01:00
Puskar Basu
18a2f65b41 Refactor display configuration options code. 2023-04-17 11:06:07 +01:00
Binaek Sarkar
299697ae2f Updates in cache configuration to allow disabling of all caching on server. Closes #3258
STEAMPIPE_CACHE environment variable resolves to service cache enabled as well as client cache enabled

service cache enabled is used by the plugin manager to enable/disable caching on the plugins during startup (runtime toggle is not allowed) - with a max_ttl

client cache enabled is used to enable/disable the cache on the database connection (fdw)
A TTL can also be set on the client side capped to max_ttl on the server
2023-03-31 15:12:25 +01:00
kaidaguerre
df9c3a253a Optimize RefreshConnections by cloning schemas where possible. Optimize plugineManager.Get when retrieving multiple connections from same plugin. Closes #3236 2023-03-16 14:43:56 +00:00
Binaek Sarkar
ee8b6647c4 Rationalising 'status hooks'. Do not show spinner when setting status, instead require an explicit Show. #2432 2023-03-14 11:48:14 +00:00
kaidaguerre
92396d77c0 Remove connection pool min size. Remove need to create empty mod introspection tables if introspection is not enabled. Remove connection pool min size. Closes #3207
* Remove all references to prepared statements
* remove sessionInitWaitGroup
2023-03-09 16:55:08 +00:00
kaidaguerre
075fafec09 Use single Steampipe Postgres notification channel (#3191) 2023-03-07 17:34:41 +00:00
kaidaguerre
2171ce66ba Fix Postgres error "cached plan must not change result type" when dynamic plugin schema changes. Update interactive .inspect and autocomplete based on changes to connection config or dynamic schema updates. Closes #3184. Closes #3185 2023-03-03 18:45:40 +00:00
Binaek Sarkar
c896d88e88 Make workspace loading async. Closes #3123 2023-02-20 17:18:33 +00:00
kaidaguerre
b67d39ecde Fix duplicated text input on interactive prompt during initialisation. Closes #3075 2023-02-16 12:35:43 +00:00