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

56 bug snmpv3 usmstatsnotintimewindows #163

Closed
wants to merge 7 commits into from

Conversation

carlkidcrypto
Copy link
Owner

Adds in UTs to catch #56 .

This is the test script I used to verify the behavior that @Guens requested.

from ezsnmp import Session
from time import sleep

SESS_ARGS_V2 = {
    "version": 2,
    "hostname": "IP_ADDRESS_1_HERE",
    "remote_port": 161,
    "community": "public",
}

SESS_ARGS_V2_2 = {
    "version": 2,
    "hostname": "IP_ADDRESS_2_HERE",
    "remote_port": 11161,
    "community": "public",
}

if __name__ == '__main__':
    counter = 0
    while True:
        session_1 = Session(**SESS_ARGS_V2)
        session_2 = Session(**SESS_ARGS_V2_2)
        print(f"session_1: {session_1.get('sysDescr.0')}\n\n\n")
        print(f"session_2: {session_2.get('sysDescr.0')}\n\n\n")
        del session_1
        del session_2

        session_1 = Session(**SESS_ARGS_V2)
        session_2 = Session(**SESS_ARGS_V2_2)
        print(f"session_2: {session_2.get('sysDescr.0')}\n\n\n")
        print(f"session_1: {session_1.get('sysDescr.0')}\n\n\n")
        del session_1
        del session_2

        sleep(1)

I ran this (above) script for a few minutes without issues.
Here's some sample output as proof.

session_1: <SNMPVariable value='Hardware: Intel64 Family 6 Model 167 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 22631 Multiprocessor Free)' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>



session_2: <SNMPVariable value='Linux carlkidcrypto-ubuntu 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>



session_2: <SNMPVariable value='Linux carlkidcrypto-ubuntu 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>



session_1: <SNMPVariable value='Hardware: Intel64 Family 6 Model 167 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 22631 Multiprocessor Free)' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>

- Adding tests to catch the bug. So far tests pass. Perhaps I need to different IPs with the same engine id. Not sure how to do that using my local config. I'll need to look into it.
- remove some unused variables in the integration tests.
@carlkidcrypto carlkidcrypto linked an issue Aug 30, 2024 that may be closed by this pull request
@carlkidcrypto carlkidcrypto self-assigned this Aug 30, 2024
@carlkidcrypto carlkidcrypto added the bug Something isn't working label Aug 30, 2024
Copy link

Valgrind Comment

Python Version Results OS Version
3.8 sh ==8213== LEAK SUMMARY: ==8213== definitely lost: 112 bytes in 7 blocks ==8213== indirectly lost: 0 bytes in 0 blocks ==8213== possibly lost: 73,744 bytes in 116 blocks ==8213== still reachable: 2,169,059 bytes in 1,176 blocks ==8213== suppressed: 74,488 bytes in 178 blocks ==8213== Reachable blocks (those to which a pointer was found) are not shown. ==8213== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.9 sh ==8183== LEAK SUMMARY: ==8183== definitely lost: 112 bytes in 7 blocks ==8183== indirectly lost: 0 bytes in 0 blocks ==8183== possibly lost: 310,133 bytes in 471 blocks ==8183== still reachable: 2,420,294 bytes in 1,436 blocks ==8183== suppressed: 68,037 bytes in 163 blocks ==8183== Reachable blocks (those to which a pointer was found) are not shown. ==8183== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.10 sh ==8234== LEAK SUMMARY: ==8234== definitely lost: 112 bytes in 7 blocks ==8234== indirectly lost: 0 bytes in 0 blocks ==8234== possibly lost: 267,228 bytes in 399 blocks ==8234== still reachable: 1,767,678 bytes in 1,368 blocks ==8234== suppressed: 68,403 bytes in 163 blocks ==8234== Reachable blocks (those to which a pointer was found) are not shown. ==8234== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.11 sh ==8148== LEAK SUMMARY: ==8148== definitely lost: 6,544 bytes in 14 blocks ==8148== indirectly lost: 11,160 bytes in 12 blocks ==8148== possibly lost: 5,290 bytes in 7 blocks ==8148== still reachable: 10,697,180 bytes in 141,007 blocks ==8148== suppressed: 69,898 bytes in 166 blocks ==8148== Reachable blocks (those to which a pointer was found) are not shown. ==8148== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.12 sh ==8230== LEAK SUMMARY: ==8230== definitely lost: 5,592 bytes in 13 blocks ==8230== indirectly lost: 2,026 bytes in 3 blocks ==8230== possibly lost: 4,152 bytes in 6 blocks ==8230== still reachable: 10,605,825 bytes in 140,958 blocks ==8230== suppressed: 68,382 bytes in 163 blocks ==8230== Reachable blocks (those to which a pointer was found) are not shown. ==8230== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest

Copy link

Valgrind Comment

Python Version Results OS Version
3.8 sh ==8257== LEAK SUMMARY: ==8257== definitely lost: 112 bytes in 7 blocks ==8257== indirectly lost: 0 bytes in 0 blocks ==8257== possibly lost: 73,744 bytes in 116 blocks ==8257== still reachable: 2,169,059 bytes in 1,176 blocks ==8257== suppressed: 74,488 bytes in 178 blocks ==8257== Reachable blocks (those to which a pointer was found) are not shown. ==8257== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.9 sh ==8195== LEAK SUMMARY: ==8195== definitely lost: 112 bytes in 7 blocks ==8195== indirectly lost: 0 bytes in 0 blocks ==8195== possibly lost: 310,133 bytes in 471 blocks ==8195== still reachable: 2,420,294 bytes in 1,436 blocks ==8195== suppressed: 68,037 bytes in 163 blocks ==8195== Reachable blocks (those to which a pointer was found) are not shown. ==8195== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.10 sh ==8313== LEAK SUMMARY: ==8313== definitely lost: 112 bytes in 7 blocks ==8313== indirectly lost: 0 bytes in 0 blocks ==8313== possibly lost: 266,540 bytes in 398 blocks ==8313== still reachable: 1,768,366 bytes in 1,369 blocks ==8313== suppressed: 68,403 bytes in 163 blocks ==8313== Reachable blocks (those to which a pointer was found) are not shown. ==8313== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.11 sh ==8350== LEAK SUMMARY: ==8350== definitely lost: 6,544 bytes in 14 blocks ==8350== indirectly lost: 11,160 bytes in 12 blocks ==8350== possibly lost: 5,290 bytes in 7 blocks ==8350== still reachable: 10,697,180 bytes in 141,007 blocks ==8350== suppressed: 69,898 bytes in 166 blocks ==8350== Reachable blocks (those to which a pointer was found) are not shown. ==8350== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.12 sh ==8203== LEAK SUMMARY: ==8203== definitely lost: 5,592 bytes in 13 blocks ==8203== indirectly lost: 2,026 bytes in 3 blocks ==8203== possibly lost: 4,152 bytes in 6 blocks ==8203== still reachable: 10,605,825 bytes in 140,958 blocks ==8203== suppressed: 68,382 bytes in 163 blocks ==8203== Reachable blocks (those to which a pointer was found) are not shown. ==8203== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest

Copy link

Valgrind Comment

Python Version Results OS Version
3.8 sh ==8273== LEAK SUMMARY: ==8273== definitely lost: 112 bytes in 7 blocks ==8273== indirectly lost: 0 bytes in 0 blocks ==8273== possibly lost: 73,744 bytes in 116 blocks ==8273== still reachable: 2,169,059 bytes in 1,176 blocks ==8273== suppressed: 74,488 bytes in 178 blocks ==8273== Reachable blocks (those to which a pointer was found) are not shown. ==8273== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.9 sh ==8168== LEAK SUMMARY: ==8168== definitely lost: 112 bytes in 7 blocks ==8168== indirectly lost: 0 bytes in 0 blocks ==8168== possibly lost: 310,133 bytes in 471 blocks ==8168== still reachable: 2,420,294 bytes in 1,436 blocks ==8168== suppressed: 68,037 bytes in 163 blocks ==8168== Reachable blocks (those to which a pointer was found) are not shown. ==8168== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.10 sh ==8247== LEAK SUMMARY: ==8247== definitely lost: 112 bytes in 7 blocks ==8247== indirectly lost: 0 bytes in 0 blocks ==8247== possibly lost: 267,228 bytes in 399 blocks ==8247== still reachable: 1,767,678 bytes in 1,368 blocks ==8247== suppressed: 68,403 bytes in 163 blocks ==8247== Reachable blocks (those to which a pointer was found) are not shown. ==8247== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.11 sh ==8249== LEAK SUMMARY: ==8249== definitely lost: 5,272 bytes in 13 blocks ==8249== indirectly lost: 8,990 bytes in 10 blocks ==8249== possibly lost: 5,290 bytes in 7 blocks ==8249== still reachable: 10,700,622 bytes in 141,010 blocks ==8249== suppressed: 69,898 bytes in 166 blocks ==8249== Reachable blocks (those to which a pointer was found) are not shown. ==8249== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.12 sh ==8179== LEAK SUMMARY: ==8179== definitely lost: 5,592 bytes in 13 blocks ==8179== indirectly lost: 2,026 bytes in 3 blocks ==8179== possibly lost: 4,152 bytes in 6 blocks ==8179== still reachable: 10,605,825 bytes in 140,958 blocks ==8179== suppressed: 68,382 bytes in 163 blocks ==8179== Reachable blocks (those to which a pointer was found) are not shown. ==8179== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest

@carlkidcrypto
Copy link
Owner Author

Adds in UTs to catch #56 .

This is the test script I used to verify the behavior that @Guens requested.

from ezsnmp import Session
from time import sleep

SESS_ARGS_V2 = {
    "version": 2,
    "hostname": "IP_ADDRESS_1_HERE",
    "remote_port": 161,
    "community": "public",
}

SESS_ARGS_V2_2 = {
    "version": 2,
    "hostname": "IP_ADDRESS_2_HERE",
    "remote_port": 11161,
    "community": "public",
}

if __name__ == '__main__':
    counter = 0
    while True:
        session_1 = Session(**SESS_ARGS_V2)
        session_2 = Session(**SESS_ARGS_V2_2)
        print(f"session_1: {session_1.get('sysDescr.0')}\n\n\n")
        print(f"session_2: {session_2.get('sysDescr.0')}\n\n\n")
        del session_1
        del session_2

        session_1 = Session(**SESS_ARGS_V2)
        session_2 = Session(**SESS_ARGS_V2_2)
        print(f"session_2: {session_2.get('sysDescr.0')}\n\n\n")
        print(f"session_1: {session_1.get('sysDescr.0')}\n\n\n")
        del session_1
        del session_2

        sleep(1)

I ran this (above) script for a few minutes without issues. Here's some sample output as proof.

session_1: <SNMPVariable value='Hardware: Intel64 Family 6 Model 167 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 22631 Multiprocessor Free)' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>



session_2: <SNMPVariable value='Linux carlkidcrypto-ubuntu 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>



session_2: <SNMPVariable value='Linux carlkidcrypto-ubuntu 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>



session_1: <SNMPVariable value='Hardware: Intel64 Family 6 Model 167 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 22631 Multiprocessor Free)' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>

@Guens reminded me this is for V3. Try this again with V3.

Copy link

github-actions bot commented Sep 2, 2024

Valgrind Comment

Python Version Results OS Version
3.8 sh ==8227== LEAK SUMMARY: ==8227== definitely lost: 112 bytes in 7 blocks ==8227== indirectly lost: 0 bytes in 0 blocks ==8227== possibly lost: 73,744 bytes in 116 blocks ==8227== still reachable: 2,169,753 bytes in 1,178 blocks ==8227== suppressed: 74,488 bytes in 178 blocks ==8227== Reachable blocks (those to which a pointer was found) are not shown. ==8227== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.9 sh ==8260== LEAK SUMMARY: ==8260== definitely lost: 112 bytes in 7 blocks ==8260== indirectly lost: 0 bytes in 0 blocks ==8260== possibly lost: 309,437 bytes in 470 blocks ==8260== still reachable: 2,421,684 bytes in 1,439 blocks ==8260== suppressed: 68,037 bytes in 163 blocks ==8260== Reachable blocks (those to which a pointer was found) are not shown. ==8260== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.10 sh ==8144== LEAK SUMMARY: ==8144== definitely lost: 112 bytes in 7 blocks ==8144== indirectly lost: 0 bytes in 0 blocks ==8144== possibly lost: 267,228 bytes in 399 blocks ==8144== still reachable: 1,768,372 bytes in 1,370 blocks ==8144== suppressed: 68,403 bytes in 163 blocks ==8144== Reachable blocks (those to which a pointer was found) are not shown. ==8144== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.11 sh ==8260== LEAK SUMMARY: ==8260== definitely lost: 5,296 bytes in 13 blocks ==8260== indirectly lost: 10,105 bytes in 11 blocks ==8260== possibly lost: 8,714 bytes in 10 blocks ==8260== still reachable: 10,696,761 bytes in 141,008 blocks ==8260== suppressed: 69,898 bytes in 166 blocks ==8260== Reachable blocks (those to which a pointer was found) are not shown. ==8260== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest
3.12 sh ==8264== LEAK SUMMARY: ==8264== definitely lost: 5,592 bytes in 13 blocks ==8264== indirectly lost: 2,028 bytes in 3 blocks ==8264== possibly lost: 4,152 bytes in 6 blocks ==8264== still reachable: 10,606,513 bytes in 140,960 blocks ==8264== suppressed: 68,382 bytes in 163 blocks ==8264== Reachable blocks (those to which a pointer was found) are not shown. ==8264== To see them, rerun with: --leak-check=full --show-leak-kinds=all ubuntu-latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] snmpv3 usmStatsNotInTimeWindows
1 participant