Broken tests on pulp_deb main branch: "You cannot call this from an async context - use a thread or sync_to_async."

Most tests on the pulp_deb main branch are throwing errors like the following:

pulp_smash.pulp3.bindings.PulpTaskError: (PulpTaskError(...), 'Pulp task failed (You cannot call this from an async context - use a thread or sync_to_async.)')

I am not sure if this is a problem in pulp_deb or in pulp_smash. Any ideas? Any other plugins with the same issue?

Example GHA pipeline: https://github.com/pulp/pulp_deb/pull/352/checks?check_run_id=3584381158

It is related to this issue: Refactor #9354: Disable DJANGO_ALLOW_ASYNC_UNSAFE for content app - Pulp
I had to address a similar issue on pulp-ansible, you can see the discussion on this PR:
https://github.com/pulp/pulpcore/pull/1614#issuecomment-916077944

1 Like

At the Pulpcore meeting this morning we discussed reverting this change for 3.16, and deferring it to 3.17, to provide a little more time to adjust.

1 Like

I don’t know about reverting or not reverting. What I do know is that I am on a break next week and probably won’t get around to looking into this further until after that break. The pulp_deb tests are broken until the underlying issue is fixed in pulp_deb or else until the pulpcore change is reverted. Not sure if that really matters.

This change has been reverted and it will not be included in 3.16. TLDR; there is no action item in this area until 3.17 release

Actually, this means this should be fixed in plugins in the release that declares compatibility with 3.16 & 3.17. Plainly speaking it should be considered deprecated in 3.16.
We are still discussing how we can turn this on in the plugin CI once that plugin decided to implement it (prior to pulpcore 3.17).

1 Like

We added the tasking_allow_async_unsafe flag to the plugin template which if set to False will enforce the check in ci prior to 3.17. This flag will have no effect when used with pulpcore >=3.17.
If this works out, we can expect a similar approach for the content app in the future.