Closed jamiebrynes7 closed 5 years ago
@davedissian and found the root cause for this, upon creating the WorkerConnection
object, we proactively grab the worker attributes to cache them:
let sdk_attr = Worker_Connection_GetWorkerAttributes(connection_ptr);
let attributes = ::std::slice::from_raw_parts(
(*sdk_attr).attributes,
(*sdk_attr).attribute_count as usize,
)
.iter()
.map(|s| CStr::from_ptr(*s).to_string_lossy().to_string())
.collect();
However, in the case where the connection attempt fails, Worker_Connection_GetWorkerAttributes()
will return an un-initialised struct meaning that (*sdk_attr).attributes
is a null pointer!
This should be a quick and easy fix however :smile:
Actually, the returned object is initialized correctly, however it is default/zero initialized, so the returned const char**
is NULL
, so the from_raw_parts
needs a null check.
Yeah what he said :stuck_out_tongue:
Oddly this is not repro with 100% accuracy:
My guess is some assumption is being broken when this errors.