Skip to content

README refresh - #3

Merged
fangpenlin merged 1 commit into
LaunchPlatform:masterfrom
mahmoud:readme-reread
Apr 6, 2025
Merged

fangpenlin merged 1 commit into
LaunchPlatform:masterfrom
mahmoud:readme-reread

Conversation

@mahmoud

@mahmoud mahmoud commented Apr 6, 2025

Copy link
Copy Markdown
Contributor

Hey again! Been about 3 months of bq in production, and it's been great! Finally getting around to a TODO to come back and fix up README issues I found during integration.

Mostly this is minor grammatical and typo fixes, but by far the most important improvement in here is just a subtle change to emphasize the listen_events registration. I probably spent about 4-6 hours trying to figure out what was wrong with my custom worker, when the issue was that I had forgotten to register my custom task.

Anyways, hopefully nothing controversial here, but happy to discuss/iterate. I do have some bigger learnings/ideas, but I'll save those for separate issues :) Thanks!

@fangpenlin fangpenlin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for fixing the typos and imrpoving he documents. Also glad that you find this project useful in production 😄👍

@fangpenlin
fangpenlin merged commit c30a519 into LaunchPlatform:master Apr 6, 2025
Fazel94 pushed a commit to Fazel94/bq that referenced this pull request Nov 23, 2025
Identified 8 bugs in threading implementation:

CRITICAL (3):
- Bug LaunchPlatform#1: Database session never closed in worker heartbeat thread
- Bug LaunchPlatform#2: AttributeError when worker is None in HTTP health check
- Bug LaunchPlatform#3: Session leak in HTTP request handler

HIGH (2):
- Bug LaunchPlatform#4: No error handling in worker heartbeat thread
- Bug LaunchPlatform#5: Stale worker object in heartbeat thread

MODERATE (3):
- Bug LaunchPlatform#6: Race condition in metrics server shutdown
- Bug LaunchPlatform#7: Potential duplicate NOTIFY when transaction is None
- Bug LaunchPlatform#8: Thread join timeout may leave zombie threads

Report includes detailed descriptions, reproduction steps,
recommended fixes, and priority recommendations for each bug.
Fazel94 pushed a commit to Fazel94/bq that referenced this pull request Dec 30, 2025
CRITICAL FIXES (3):
- Bug LaunchPlatform#1: Fixed session management in update_workers thread
  * Create fresh session each iteration instead of reusing
  * Always close session in finally block
  * Prevents connection pool exhaustion and stale connections

- Bug LaunchPlatform#2: Fixed AttributeError in HTTP health check
  * Check if worker is None before accessing worker.state
  * Return proper error state ("NOT_FOUND") when worker is missing
  * Prevents HTTP server crashes

- Bug LaunchPlatform#3: Fixed session leak in HTTP request handler
  * Close database session in finally block for all requests
  * Prevents connection pool exhaustion from health checks

HIGH SEVERITY FIXES (2):
- Bug LaunchPlatform#4: Added error handling to update_workers thread
  * Wrap all database operations in try/except
  * Log errors with full traceback
  * Rollback failed transactions
  * Continue heartbeat loop after errors (no silent death)

- Bug LaunchPlatform#5: Fixed stale worker object in heartbeat thread
  * Refresh worker object from database each iteration
  * Check if worker exists (handle deletion case)
  * Prevents updates to detached/stale objects

MODERATE FIXES (3):
- Bug LaunchPlatform#6: Fixed metrics server shutdown race condition
  * Use threading.Event instead of callback assignment
  * Store server instance in thread-safe manner
  * Prevents race condition during early shutdown

- Bug LaunchPlatform#7: Added logging for duplicate NOTIFY
  * Log debug message when transaction is None
  * Explains why deduplication is not possible
  * Minor performance impact, not critical

- Bug LaunchPlatform#8: Fixed thread join timeout handling
  * Check if threads stopped after join timeout
  * Log errors if threads still alive
  * Only mark worker as SHUTDOWN if heartbeat thread stopped
  * Prevents zombie threads and state inconsistencies

All fixes tested with syntax check and module import.
Module instantiation successful.
@mahmoud
mahmoud deleted the readme-reread branch April 21, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants