Skip to content

fix: prevent AttributeError in joblib worker config sync#2111

Open
Ayush10 wants to merge 1 commit intomicrosoft:mainfrom
Ayush10:fix/issue-2038-joblib-worker-crash
Open

fix: prevent AttributeError in joblib worker config sync#2111
Ayush10 wants to merge 1 commit intomicrosoft:mainfrom
Ayush10:fix/issue-2038-joblib-worker-crash

Conversation

@Ayush10
Copy link

@Ayush10 Ayush10 commented Jan 30, 2026

Summary

Closes #2038

When backtests spawn joblib worker processes, register_from_C can crash with:

AttributeError: No such registered in self._config

This happens because the worker's fresh Config instance may not have the _registered key available when C.registered is accessed.

Fix

Replace the direct attribute access with a safe getattr call:

# Before
if C.registered and skip_register:

# After
if getattr(C, "registered", False) and skip_register:

This defaults to False when the attribute is missing, allowing the worker to proceed with config synchronization from the main process.

Test Plan

  • Single-line defensive fix
  • Behavior unchanged when registered attribute exists
  • Gracefully handles missing attribute by defaulting to False

)

In joblib worker processes, `register_from_C` can crash with
`AttributeError: No such registered in self._config` when the
worker's fresh Config instance hasn't fully initialized `_registered`.

Use `getattr(C, "registered", False)` to safely default to False
when the attribute is missing, allowing the worker to proceed with
config synchronization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backtest/joblib worker crash: AttributeError: No such registered in self._config

1 participant