Skip to content

find_process returns Process object with incorrect start_time, causing is_process_alive to always return False #301

Description

@liaomingsen

Issue:

Describe the bug

When using find_process to locate a process, the returned Process object contains an incorrect start_time value. This causes is_process_alive to always return False for that object, even though the process is running.

To Reproduce

from libmem import *

proc1 = find_process("notepad.exe")
proc2 = get_process_ex(proc1.pid)

print(f"proc1.start_time = {proc1.start_time}")
print(f"proc2.start_time = {proc2.start_time}")
print(f"is_process_alive(proc1) = {is_process_alive(proc1)}")
print(f"is_process_alive(proc2) = {is_process_alive(proc2)}")
Output:

text
proc1.start_time = 28133258
proc2.start_time = 29584828
is_process_alive(proc1) = False
is_process_alive(proc2) = True
Expected behavior
find_process should populate the start_time field correctly, and is_process_alive should return True for the returned process object.

Environment
OS: Windows 11

Python: 3.12

libmem: 5.1.4 (from PyPI)

Additional context
This issue occurs with any process, not just specific ones. The get_process_ex function works correctly and can be used as a workaround by calling it with the PID from find_process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions