Open sanderr opened 2 years ago
I tried to reproduce this and I only got the same behaviour if I didn't wait for the test.pypi.org cache expiry. When I made sure that test.pypi.org simple page actually contained the new release and then clicked refresh, it always worked as expected.
I'll give this another go soon and take that into account, then report back.
Did you use Python 3.10? I just tried to reproduce the issue with Python 3.10 and failed, then went back to 3.9 (which I was using when I made the ticket) and succeeded. I'm pretty sure I set up my environments exactly the same otherwise. Could you see if you can reproduce it on Python 3.9?
The Python version could be a misdiagnose. I'm having trouble getting consistent behavior. It looks like sometimes it works as expected for the first new package version since the server started, but then subsequent packages will consistently result in the issue I described above. Other times even the first does not work. And then there's the inconsistency that you can't reproduce it. Would it help if I'm more exact in the commands I run? Perhaps I can even write a reproductive script. If I can get that to consistently reproduce it on my system I expect it should trigger on yours as well.
Consistently reproducing it would be very helpful. Keep the caching in mind. It is entirely possible that you can see the change in the browser or with curl, but the next request by devpi-server could hit a feedly server which still has the old version. I would say anything within at least 60s after upload can entirely be attributed to caching.
I tested with Python 3.8.6.
That's an interesting addendum, I only waited about 10 seconds each time. I've got a script now (I'll share it once it's more or less stable) and I'll add a 120 second wait to check if it might just be that. But from the fact that a second refresh consistently works I honestly suspect it's something else (though I must admit I have little experience here).
I'm finally getting some consistency with my testing. Alas it looks like I can't reproduce it to the extent I described when I first opened this issue. It's possibly I was too naive in my testing back then, or I might be missing something now. Either way, here's the current situation with a reliable reproduction. My approach: I set up a server with a new server dir, create the index as described above, upload a package to TestPyPi, refresh and check for results. If this didn't work I refresh again and check once more. Results:
Is this expected behavior?
The server where I initially encountered this issue is a long-running one, not one that just got started as in my example scenario. Yet, I consistently got this behavior there as well. That said, I can't say with complete confidence I tried increasing the wait time there, so that could be the explanation.
I've attached my testing script if you want to experiment with this yourself. It's not pretty but it does the job. Usage: usage: TWINE_USERNAME=<testpypi_username> TWINE_PASSWORD=<testpypi_pass> ./reproduce.sh <package_name> <new_version> <nb_attempts>
, where <package_name>
is the name of a package that does not exist yet or you are the author of on TestPyPi, <new_version>
is a version to upload that does not exist yet and <nb_attempts>
is the number of loops to run on the same server (I recommend 2 to observe the behavior I described).
Description
The refresh button / API endpoint consistently requires two clicks/requests to fetch a new package from PyPi. The first does not have any visible effect, the second makes the new package versions appear.
Steps to reproduce
devpi-server
devpi-server
devpi use <server_url>
devpi index --create root/testpypi type=mirror volatile=False mirror_url=https://test.pypi.org/simple/ mirror_web_url_fmt=https://test.pypi.org/project/{name}/ title=TestPyPi
<server_url>/testpypi/+simple/<package_name>
-> nothingEnvironment
Arch Linux, Python 3.9.10