Files
steampipe/pkg
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
..