Fix #1840: Exception when p2p is shutting down#1860
Fix #1840: Exception when p2p is shutting down#1860JiwaniZakir wants to merge 1 commit intostratosphereips:developfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
hello @JiwaniZakir Thanks for the fix! i will review, but first can you change the base to develop instead of master? thanks! |
|
The fix is correct — |
Closes #1840
Fixes Issue
Closes #1840
Changes proposed
modules/p2ptrust/p2ptrust.py,shutdown_gracefully()(line 597): Tightened the guard fromif hasattr(self, "pigeon")toif hasattr(self, "pigeon") and self.pigeon is not None. When the pigeon binary is missing or_configure()setsself.pigeon = None, the previous check passed thehasattrtest but immediately raisedAttributeError: 'NoneType' object has no attribute 'send_signal'on thesend_signalcall.tests/unit/modules/p2ptrust/test_p2ptrust.py(new file): Adds three unit tests covering the three distinct states ofself.pigeonat shutdown: attribute absent, attribute isNone, and attribute holds a live mock process. The last case assertssend_signalis called withsignal.SIGINT.Steps you followed to test the changes purposed in this PR:
Trustwithself.pigeon = Noneand callingshutdown_gracefully()— confirmedAttributeErrorbefore the fix.pytest tests/unit/modules/p2ptrust/test_p2ptrust.py -v— all 3 tests passed.Check List (Check all the applicable boxes)
Screenshots
N/A
Note to reviewers
The root cause is that
_configure()can explicitly assignself.pigeon = Nonewhen the pigeon subprocess fails to start, sohasattralone is not a sufficient guard. The fix is minimal and surgical; no behaviour changes whenpigeonis a live process.