Skip to content

Null dependencies result when multiple calls to getBean for the same bean are made asynchronously #521

@mawaruDOLL

Description

@mawaruDOLL

I'm working with a ColdFusion project using FW/1 and DI/1 whose front end provides dashboards for viewing data. Each dashboard is comprised of widgets that give the user a specific view of or information about some data. The data for each widget is loaded via separate Ajax calls, so multiple calls can be made at the same time which use the same server side resources (services, beans, etc...). The widget data loaded by the Ajax calls is actually coming from a subsystem, which I don't think is a factor in the situation I'm seeing but I'll mention in case I have overlooked something.

I have found that reloading on such a page can result in null dependencies in beans and services, which causes exceptions to occur when calls are made to the injected services' methods. I believe what is happening is that one request begins the resolution process for a Bean in resolveBean, then another request starts it again and sets the dependencies to null, after which the first request will likely finish by setting the dependencies to null in the accumulator cache because the second request wiped out the resolved dependencies that the first request had already set up. After that, the injected dependencies will continue to be null until a successful reload is done since they are null in the accumulator cache. The issue pops up unpredictably because it's caused by a race condition.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions