-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
The v23 context functions (eg. WithNewPrincipal) rely on a storing a pointer to the currently initialized runtime in the context. This accessed by the initStateData.currentRuntime() method. This method checks to ensure that the runtime has been initialized, ie. is non-nil.
if i.runtime == nil {
panic(`Calling v23 method during runtime initialization. You cannot
call v23 methods until after the runtime has been constructed. You may
be able to move the offending caller to the Runtime.Init() method of your
runtime implementation.`)
}However, the runtime may be nil under two circumstances:
- it has yet to be initialized, and the error message above makes sense
- the runtime's shutdown function (returned when it is created) has been called, in which case, the error message above is confusing.
Situation 2 can arise if a process has go routines that are still running when shutdown is called that attempt, for example, to make an RPC. Although this is an application programming error, the error message and v23 package code should be modified to distinguish the two cases.
Metadata
Metadata
Assignees
Labels
No labels