queue2: eos races against downstream error in push mode
I can reproduce this fairly reliably with gst-discoverer-1.0 and a jpeg file with 4 components, which jpegdec doesn't support, if the jpeg is accessed over sftp. The symptom is that gst-discoverer-1.0 times out. Attaching gdb to it shows that the only threads running are queue2 and typefind tasks, which are both paused.
As far as I can tell, if queue2 in push mode gets eos from upstream before it gets the error from jpegdec, it handles it properly, creating an internal data flow error. If the error arrives first, that sets queue->srcresult and queue->sinkresult to GST_FLOW_ERROR (here), and doesn't emit the error (here). The code in gst_queue2_handle_sink_event() that would emit the error when the eos arrives actually doesn't get to run because queue->sinkresult is not GST_FLOW_OK, and that gets checked first (here) causing the event to be dropped.
I don't have any useful thoughts on how to fix this. I can provide a test image and some debug logs if that would help.