Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue24 #25

Merged
merged 2 commits into from
Aug 29, 2023
Merged

Fixed issue24 #25

merged 2 commits into from
Aug 29, 2023

Conversation

LegendEvent
Copy link

@LegendEvent LegendEvent commented Aug 23, 2023

Fix the problem by adding a queue instead of an error message and restarting continuously

Thread Pooling for Plugin Event Callbacks in Pwnagotchi

Description

Implemented a thread pooling mechanism for executing plugin event callbacks in the Pwnagotchi plugin management system (init.py). Instead of creating a new thread for each callback, a fixed number of worker threads are now utilized to execute queued tasks. This mitigates the "can't start new thread" error by limiting the number of concurrently running threads.

Motivation and Context

The changes address the issue where the Pwnagotchi system throws a "can't start new thread" error due to excessive thread creation when handling multiple plugin event callbacks. Especially on devices with limited resources like the Raspberry Pi Zero, this can lead to system resource exhaustion. By using a thread pool, we ensure efficient use of threads, preventing resource overuse and the aforementioned error.

Link to the issue: #24

  • I have raised an issue to propose this change (required)

How Has This Been Tested?

The modifications have been reviewed for syntactical accuracy, and the logic aligns with standard thread pooling implementations.
Replaced the init.py file and deleted the cache file. Reboot the pwnagotchi and I did not received any error.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s

Fix the problem by adding a queue instead of an error message and restarting continuously
Signed-off-by: Luca Paulmann <[email protected]>
@aluminum-ice aluminum-ice merged commit c28188d into aluminum-ice:master Aug 29, 2023
@aluminum-ice
Copy link
Owner

@LegendEvent Have you seen a crash that happens when there are a lot of APs in the area? It seems like a similar thread exhaustion problem to the one you solved here with this PR. I don't have a way to email you directly to discuss on github. Is there a way to connect?

@LegendEvent
Copy link
Author

@aluminum-ice No, I have not yet experienced crashes in an environment with many APs. I have tested the Pwnagotchi in a test environment with about 30 APs, which was also designed for heavy traffic. There I could not find any errors or crashes. You can write me via Discord "LegendEvent".

@LegendEvent LegendEvent deleted the fixed-issue24 branch August 31, 2023 11:52
@aluminum-ice
Copy link
Owner

aluminum-ice commented Aug 31, 2023

@aluminum-ice No, I have not yet experienced crashes in an environment with many APs. I have tested the Pwnagotchi in a test environment with about 30 APs, which was also designed for heavy traffic. There I could not find any errors or crashes. You can write me via Discord "LegendEvent".

@LegendEvent It seems you have to enable adding friends on Discord before I can message you directly. Or you can add me aluminum_ice on Discord.

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