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

AttributeError: "'NoneType' object has no attribute '_callback'" in format_info in slow_coro_detection.utils #7602

Closed
kozlovsky opened this issue Sep 18, 2023 · 2 comments
Assignees

Comments

@kozlovsky
Copy link
Contributor

Here:

def format_info(handle: Handle, include_stack: bool = False, stack_cut_duration: Optional[float] = None,
                limit: Optional[int] = None, enable_profiling_tip: bool = True) -> str:
    """
    Returns the representation of a task executed by asyncio, with or without the stack.
    """
    func = handle._callback  # <-- here

It is a race condition. In SlowCoroWatchingThread.run, we have:

class SlowCoroWatchingThread(Thread):
    ...
    def run(self):
        ...
        with lock:
            handle, start_time = current.handle, current.start_time
        
        if handle is not None:
            ...
            _report_freeze(current.handle, duration, first_report=prev_reported_handle is not handle)

It looks like we should pass handle instead of current.handle to _report_freeze, as accessing the current.handle attribute here is not protected by the lock.

@kozlovsky kozlovsky added this to the 7.14.0 milestone Sep 18, 2023
@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-1B2

@kozlovsky
Copy link
Contributor Author

Fixed in #7613

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

No branches or pull requests

1 participant