Azure / iotedge-lorawan-starterkit

Sample implementation of LoRaWAN components to connect LoRaWAN antenna gateway running IoT Edge directly with Azure IoT.
https://azure.github.io/iotedge-lorawan-starterkit/2.2.1
Other
184 stars 62 forks source link

Using on ServiceFacadeHttpClientHandler cause object disposed exception #534

Closed Mandur closed 2 years ago

Mandur commented 3 years ago

Since we fixed the dispose error on the existing code, we added a using here that cause the E2E to fail (see below)

Proposed course of action

let's ignore this error for now and use an injected httpclientfactory in the LBS evolution.

Expected Behavior

This call should work

Current Behavior

End to end test return error 17:32:23.661 [UDPLOG] [primary] 01F5A90000000011: failed to get join devices from api. Cannot access a disposed object. cf https://github.com/Azure/iotedge-lorawan-starterkit/runs/3897754806?check_suite_focus=true

Steps to Reproduce

Run the E2E on dev

p-schuler commented 3 years ago

Ownership is passed to the HttpClient and hence, the HttpClient would be responsible to dispose the handler. We can't dispose it the way we have it right now. In theory the ServiceFacadeHttpClientProvider, who owns the HttpClient would need a dispose. Since we do not have proper application lifecycle management and the ServiceFacadeHttpClientProvider has application lifetime, it's hard to add this atm. As Mik suggested, let's fix this in general for the project and bring in DI and proper app lifecycle management that will solve this issue for us.

p-schuler commented 2 years ago

This was changed and we do no longer dispose it.