Skip to content

Logs flooded with cannot find the current context #85

Description

@moritonal

Hihi

On the latest-version, seeing a lot of this in the logs:

E, [2023-02-14T16:46:29.307789 #87679] ERROR -- : cannot find the current context.

This is coming from this line which may be mistakenly hiding a bug?

The code is:

def current_entity
      if entity = Thread.current[LOCAL_KEY]
        entity
      else
        handle_context_missing
      end
end

But when I run Thread.current[LOCAL_KEY] I get uninitialized constant XRay::NetHttp::HTTPInstanceInterceptor::LOCAL_KEY which I imagine is unintended.

Ah, but further research shows this is coming from the Unleash gem I use which runs on a scheduled task on it's own Thread.

So Unleash fires, calling http-fetch which get's intercepted by XRay which throws an error because no context is set.

I've also found an undocumented context_missing option of IGNORE_ERROR which silences the issue.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions