Snapped PyQt 5.15.2 application hangs on QNetworkAccessManager

I found a rather strange issue while updating the snap for MusicBrainz Picard.

If you use PyQt > 5.13.2 and the applications initializes a QNetworkAccessManager the app will just hang there when starting.

I implemented a small reproducer at https://github.com/phw/doesnotsnap

If you build this snap and install it with snap install --dangerous and try to run it, this will never show the main window. Instead it will hang just after printing “Application: Before QNetworkAccessManager” during initialization of QNetworkAccessManager.

This does not happen with Qt 5.13.2, but with Qt 5.14.2 and 5.15.2 it does (I did not test the other patch versions).

The snap has the network plug connected, and the network-manager-observe plug is also specified. If by default network-manager-observe is not connected QNetworkAccessManager will throw an additional error about not being able to access the DBus service it tries to communicate with. If you connect network-manager-observe this error goes away, but it does not change the fact that the app hangs on something.