Page MenuHomeSoftware Heritage

Public graph/ API does not handle streaming results from endpoints
Closed, MigratedEdits Locked

Description

When playing around with requests.get(stream=True) I noticed that the graph API was hanging and not returning directly a stream as it is supposed to do (eg: on a big query taking ~40s to complete: https://archive.softwareheritage.org/api/1/graph/visit/edges/swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35?edges=rev:rev).

However, using the API on granet.internal.softwareheritage, the stream is correctly returned, so there is something wrong in between the "two" APIs.

Event Timeline

haltode triaged this task as Normal priority.Dec 17 2020, 4:07 PM
haltode created this task.
haltode created this object in space S1 Public.

The fix is now deployed and proxied graph responses are now properly streamed \o/

15:51 $ curl -i -H "Authorization: Bearer ${TOKEN}" https://archive.softwareheritage.org/api/1/graph/visit/edges/swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35/?edges=rev:rev | less
HTTP/1.1 200 OK
Date: Fri, 08 Jan 2021 14:52:44 GMT
Server: gunicorn/19.9.0
Content-Type: text/plain
Allow: OPTIONS, GET, OPTIONS, HEAD
X-Frame-Options: SAMEORIGIN
Vary: Cookie,Accept-Encoding
Via: 1.1 archive.softwareheritage.org
X-Varnish: 3581462
Age: 0
Via: 1.1 varnish (Varnish/6.1)
Strict-Transport-Security: max-age=15768000;
Accept-Ranges: bytes
Transfer-Encoding: chunked
Connection: keep-alive

swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35 swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd
swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35 swh:1:rev:a31e58e129f73ab5b04016330b13ed51fde7a961
swh:1:rev:a31e58e129f73ab5b04016330b13ed51fde7a961 swh:1:rev:64e05d118e357bb52a084b609436acf292ce7944
swh:1:rev:64e05d118e357bb52a084b609436acf292ce7944 swh:1:rev:4fcab6693445cfb84f2b65868c58043535090e52
swh:1:rev:4fcab6693445cfb84f2b65868c58043535090e52 swh:1:rev:ac461122c88a10b7d775de2f56467f097c9e627a
swh:1:rev:ac461122c88a10b7d775de2f56467f097c9e627a swh:1:rev:7ac139eaa6bbdb07c547b6916a808eab3897e0e3
swh:1:rev:7ac139eaa6bbdb07c547b6916a808eab3897e0e3 swh:1:rev:6454b3bdd138dfc640deb5e7b9a0668fca2d55dd
swh:1:rev:6454b3bdd138dfc640deb5e7b9a0668fca2d55dd swh:1:rev:9d5f38ba6c82359b7cec31fb27fb78ecc02f3946
swh:1:rev:9d5f38ba6c82359b7cec31fb27fb78ecc02f3946 swh:1:rev:5f0e3fe6b1504d4e6530294ec87c473aa6d2d02f
swh:1:rev:5f0e3fe6b1504d4e6530294ec87c473aa6d2d02f swh:1:rev:c739f930be1dd5fd949030e3475a884fe06dae9b
swh:1:rev:c739f930be1dd5fd949030e3475a884fe06dae9b swh:1:rev:215eada73e77ede7e15531d99f712481ddd429be
swh:1:rev:215eada73e77ede7e15531d99f712481ddd429be swh:1:rev:f5b5fab1780c98b74526dbac527574bd02dc16f8
swh:1:rev:f5b5fab1780c98b74526dbac527574bd02dc16f8 swh:1:rev:7ee18d677989e99635027cee04c878950e0752b9
swh:1:rev:7ee18d677989e99635027cee04c878950e0752b9 swh:1:rev:896c80bef4d3b357814a476663158aaf669d0fb3
swh:1:rev:896c80bef4d3b357814a476663158aaf669d0fb3 swh:1:rev:090edbe23ff57940fca7f57d9165ce57a826bd7a
swh:1:rev:090edbe23ff57940fca7f57d9165ce57a826bd7a swh:1:rev:0a373d4fc248cb707821d7dad54ce6d5bcb0cdfe
swh:1:rev:0a373d4fc248cb707821d7dad54ce6d5bcb0cdfe swh:1:rev:f79ce87fa49da778a1ad54c7d3c6755e13cf8489
swh:1:rev:f79ce87fa49da778a1ad54c7d3c6755e13cf8489 swh:1:rev:6d60ce384d1d5ca32b595244db4077a419acc687
swh:1:rev:6d60ce384d1d5ca32b595244db4077a419acc687 swh:1:rev:6d7e0ba2d2be9e50cccba213baf07e0e183c1b24
swh:1:rev:6d7e0ba2d2be9e50cccba213baf07e0e183c1b24 swh:1:rev:08529078d8d9adf689bf39cc38d53979a0869970
swh:1:rev:08529078d8d9adf689bf39cc38d53979a0869970 swh:1:rev:947134d9b00f342415af7eddd42a5fce7262a1b9
swh:1:rev:947134d9b00f342415af7eddd42a5fce7262a1b9 swh:1:rev:88edb57d1e0b262e669c5cad36646dcf5a7f37f5
swh:1:rev:88edb57d1e0b262e669c5cad36646dcf5a7f37f5 swh:1:rev:d553d03f705721fbbfe3ca1c981812d3e488217e
swh:1:rev:d553d03f705721fbbfe3ca1c981812d3e488217e swh:1:rev:5b06bbcfc2c621da3009da8decb7511500c293ed
swh:1:rev:5b06bbcfc2c621da3009da8decb7511500c293ed swh:1:rev:ddec3bdee05b06f1dda20ded003c3e10e4184cab
swh:1:rev:ddec3bdee05b06f1dda20ded003c3e10e4184cab swh:1:rev:f4e9b7af0cd58dd039a0fb2cd67d57cea4889abf
swh:1:rev:f4e9b7af0cd58dd039a0fb2cd67d57cea4889abf swh:1:rev:e3811a3f74bd1ad773667b78323f396166891f3a
swh:1:rev:e3811a3f74bd1ad773667b78323f396166891f3a swh:1:rev:55d2d0ad2fb4325f615d1950486fbc5e6fba1769
swh:1:rev:55d2d0ad2fb4325f615d1950486fbc5e6fba1769 swh:1:rev:42b3a4cb5609de757f5445fcad18945ba9239a07
swh:1:rev:42b3a4cb5609de757f5445fcad18945ba9239a07 swh:1:rev:9d0b62328d34c7044114d4f4281981d4c537c4ba
swh:1:rev:9d0b62328d34c7044114d4f4281981d4c537c4ba swh:1:rev:0c3292ca8025c5aef44dc389ac3a6bf4a325e0be
swh:1:rev:0c3292ca8025c5aef44dc389ac3a6bf4a325e0be swh:1:rev:12a78d43de767eaf8fb272facb7a7b6f2dc6a9df
swh:1:rev:12a78d43de767eaf8fb272facb7a7b6f2dc6a9df swh:1:rev:fd2fa6c18b729e19c51240453a521f76c766247e
swh:1:rev:fd2fa6c18b729e19c51240453a521f76c766247e swh:1:rev:e2a5dca753d1cdc3212519023ed8a13e13f5495b
...