ascent12 / drm_info

Moved to https://gitlab.freedesktop.org/emersion/drm_info
MIT License
63 stars 13 forks source link

Error: invalid JSON when trying to submit via curl #84

Closed shoffmeister closed 2 years ago

shoffmeister commented 2 years ago

I get Error: invalid JSON from drm_info -j | curl -X POST -d @- https://drmdb.emersion.fr/submit

This is on Fedora 36, with the binary built from sources as described in the instructions.

Before I could run the binary successfully, I had to "create" sudo ln -s libjson-c.so.5 libjson-c.so as Fedora now seem in the habit to only ship versioned .so (and no .so)

[stefan@fedora lib64]$ dnf provides libjson-c.so.5
Last metadata expiration check: 15:13:26 ago on Thu 26 May 2022 04:28:24 PM CEST.
json-c-0.15-3.fc36.i686 : JSON implementation in C
Repo        : fedora
Matched from:
Provide    : libjson-c.so.5

(json-c.x86_64 is installed, FWIW)

I have attached drm_info.json which appears to not look too unreasonable.

drm_info.json.gz

shoffmeister commented 2 years ago

FWIW, I appreciate that the server returns 400, but then drm_info -j and the server seem to be in disagreement on ... something.

emersion commented 2 years ago

This file is 584910 bytes, and the server has a 512KiB limit. I wonder what a good limit would be.

In any case, this isn't much of a drm_info issue.

shoffmeister commented 2 years ago

That dump is from a (recent) hybrid iGPU / dGPU laptop. Extending to 768 KiB would probably be quite enough to cover dual-GPU systems.

Now, if you are concerned about DoS / resource abuse, and if you have some infrastructure in place, it might be possible to crank this up to ... 5 MiB ... (quasi-infinity) and have a (reverse-proxy) rate-limiter in front of that to protect the resources. Something like 1 request/s overall (not even per IP)? That then basically limits resource consumption to at most 5 MiB at the expense of increasing potential latency in processing (I wouldn't expect that to be a problem).

I agree that this is not a drm_info issue, simply wasn't transparent from the 400 + response text.

emersion commented 2 years ago

Fixed in https://git.sr.ht/~emersion/drmdb/commit/c61ddaa07d3225b25e2fa7bb6241107eefa572b1