Skip to content

Fix thread-safety race condition in processSchemaInfo#205

Open
EzRyan25 wants to merge 1 commit into
RallyTools:masterfrom
EzRyan25:patch-4
Open

Fix thread-safety race condition in processSchemaInfo#205
EzRyan25 wants to merge 1 commit into
RallyTools:masterfrom
EzRyan25:patch-4

Conversation

@EzRyan25
Copy link
Copy Markdown

processSchemaInfo in entity.py wipes _rally_schema[wksp_ref] at the start of execution and rebuilds it incrementally. In multi-threaded applications with multiple Rally() instances sharing the same workspace, a concurrent thread reading _rally_schema during this window receives None from getSchemaItem, causing validateAttributeNames to crash with AttributeError: 'NoneType' object has no attribute 'Attributes'.

This PR fixes the race by building the schema into a local dict and performing a single atomic assignment at the end, so the shared global is never in an empty or partial state.

…when finished.

processSchemaInfo() in entity.py first assigns the global _rally_schema var indexed at wksp_ref to and empty dict, wiping out previous built schema data when there could be other instances of pyral processing stories in your application making this not thread safe as threads share this global var.

Instead build schema info into local dict and assign to global var when finished
@EzRyan25
Copy link
Copy Markdown
Author

#206

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.

1 participant