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

refactor: Added lock support to ./discovery.php -h new to prevent overlap #6568

Merged
merged 1 commit into from May 4, 2017

Conversation

Projects
None yet
5 participants
@laf
Member

laf commented May 3, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

Fixes: #4459

The proof will be in the schema lock pudding over the next few days but I'm confident. This will stop discovery from firing against the same device multiple times and potentially allowing the processes to run away with themselves.

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot May 3, 2017

Thank you for submitting a PR @laf! We have found the following @murrant, @SaaldjorMike and @f0o based on the history of these files to review this PR.

mention-bot commented May 3, 2017

Thank you for submitting a PR @laf! We have found the following @murrant, @SaaldjorMike and @f0o based on the history of these files to review this PR.

@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier May 3, 2017

The inspection completed: No new issues

scrutinizer-notifier commented May 3, 2017

The inspection completed: No new issues

@LibreNMS-CI

This comment has been minimized.

Show comment
Hide comment
@LibreNMS-CI

LibreNMS-CI commented May 3, 2017

Auto-Deploy finished, Test PR at http://6568.ci.librenms.org or https://6568.ci.librenms.org

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant May 4, 2017

Member

Well, I fork bombed my laptop and when it came back to responsiveness it seemed like only one ran at a time, but it did have to go through the whole init.php for each one.

A snippet.

...
LibreNMS Discovery
LibreNMS Discovery
LibreNMS Discovery
MySQL Error: Too many connections
MySQL Error: Too many connections
MySQL Error: Too many connections
LibreNMS Discovery
MySQL Error: Too many connections
MySQL Error: Too many connections
MySQL Error: Too many connections
LibreNMS Discovery
LibreNMS Discovery
MySQL Error: Too many connections
MySQL Error: Too many connections
===================================
Version info:
Commit SHA: a475069c9bc768857876e4ec5c4aee0176690af5
Commit Date: 1493858725
DB Schema: 189
PHP: 7.1.3
MySQL: 10.1.22-MariaDB
RRDTool: 1.6.01.6.0
SNMP: NET-SNMP 5.7.3
==================================DEBUG!
DB Schema update started....
SQL[SELECT version FROM `dbSchema` ORDER BY version DESC LIMIT 1] 
DB Schema already up to date.
SQL[SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 AND `last_discovered` IS NULL ORDER BY device_id DESC] 
./discovery.php new 2017-05-03 20:17:15 - 0 devices discovered in 17.60 secs
SNMP: Get[0/0.00s] Walk [0/0.00s]
MySQL: Cell[3/0.00s] Row[0/-0.00s] Rows[3/0.01s] Column[0/0.00s] Update[0/0.00s] Insert[0/0.00s] Delete[0/0.00s]
LibreNMS Discovery
LibreNMS Discovery
MySQL Error: Too many connections
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
...
Member

murrant commented May 4, 2017

Well, I fork bombed my laptop and when it came back to responsiveness it seemed like only one ran at a time, but it did have to go through the whole init.php for each one.

A snippet.

...
LibreNMS Discovery
LibreNMS Discovery
LibreNMS Discovery
MySQL Error: Too many connections
MySQL Error: Too many connections
MySQL Error: Too many connections
LibreNMS Discovery
MySQL Error: Too many connections
MySQL Error: Too many connections
MySQL Error: Too many connections
LibreNMS Discovery
LibreNMS Discovery
MySQL Error: Too many connections
MySQL Error: Too many connections
===================================
Version info:
Commit SHA: a475069c9bc768857876e4ec5c4aee0176690af5
Commit Date: 1493858725
DB Schema: 189
PHP: 7.1.3
MySQL: 10.1.22-MariaDB
RRDTool: 1.6.01.6.0
SNMP: NET-SNMP 5.7.3
==================================DEBUG!
DB Schema update started....
SQL[SELECT version FROM `dbSchema` ORDER BY version DESC LIMIT 1] 
DB Schema already up to date.
SQL[SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 AND `last_discovered` IS NULL ORDER BY device_id DESC] 
./discovery.php new 2017-05-03 20:17:15 - 0 devices discovered in 17.60 secs
SNMP: Get[0/0.00s] Walk [0/0.00s]
MySQL: Cell[3/0.00s] Row[0/-0.00s] Rows[3/0.01s] Column[0/0.00s] Update[0/0.00s] Insert[0/0.00s] Delete[0/0.00s]
LibreNMS Discovery
LibreNMS Discovery
MySQL Error: Too many connections
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
/home/murrant/projects/librenms/.new-discovery.lock exists, exiting
...

@murrant murrant merged commit 5f6279d into librenms:master May 4, 2017

3 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@laf laf deleted the laf:refactor/issue-4459 branch May 4, 2017

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf May 4, 2017

Member

We could check for the options earlier on to set the lock before more things happen.

Member

laf commented May 4, 2017

We could check for the options earlier on to set the lock before more things happen.

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant May 4, 2017

Member

It's pretty early and under normal operation the unit is negligible.

Member

murrant commented May 4, 2017

It's pretty early and under normal operation the unit is negligible.

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot May 18, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

lock bot commented May 18, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.