Skip to content

Race condition fix when proxy is destroyed by PipeWire while WpObject is activating

Julian Bouzas requested to merge julian/wireplumber:proxy-fixes into master

This MR fixes a race condition that happens when a proxy is destroyed by PipeWire while the WpObject is activating. When that happens, the activation transition never finishes, leaking the object because the transition holds a strong reference to it, and can also make WirePlumber hang forever if it is waiting for an object activation to finish.

To solve the above problem, a new WpObject API was added to abort all pending transitions. That new wp_object_abort_activation() is used by the proxy sub-class to abort all pending transitions when the error or pw-proxy-destroyed is received. Because of this, the old wp_proxy_watch_bind_error() is not needed anymore so it has been removed.

With the above changes, some of the unit tests were failing:

  • si-audio-endpoint: This test was failing when exporting the session item. This is because the session item creates internally a support.null-sink node, and fails when its endpoint is being exported because the support.null-sink node does not support the _PARAM_PROPS props feature which is requested here. To avoid this, the commit 38d86118 was added, which still enables the feature even if the error signal is received (like master does). Not sure if this is the proper solution though.
  • si-standard-link: This is similar to the above case. Since the support.null-sink node does not support the _PARAM_PROPS feature, we just request the minimal features so that the session item can be activated. The commit e5de522c solves this.
  • si-node: both fakesink and fakesrc nodes have ports that don't support the _PARAM_FORMAT feature, so activating them with all features when the WP_NODE_FEATURE_PORTS is requested will result in a transition error, so the wp_node_get_n_ports() from here will return 0 ports, making the test fail. Activating the ports with only minimal features solves this problem, which is what commit 418d140f does.

Merge request reports

Loading