After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 785878 - curlhttpsrc: critical warning in class_init
curlhttpsrc: critical warning in class_init
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-06 11:14 UTC by Philippe Normand
Modified: 2017-08-08 08:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.16 KB, patch)
2017-08-06 11:18 UTC, Philippe Normand
none Details | Review
updated patch (8.50 KB, patch)
2017-08-07 09:30 UTC, Philippe Normand
none Details | Review
updated patch (8.51 KB, patch)
2017-08-07 12:08 UTC, Philippe Normand
committed Details | Review
updated patch with extra http/2 error checking (9.23 KB, patch)
2017-08-07 14:57 UTC, Sam Hurst
none Details | Review
Add extra http/2 error checking (1.38 KB, patch)
2017-08-07 15:46 UTC, Sam Hurst
committed Details | Review

Description Philippe Normand 2017-08-06 11:14:06 UTC
(gst-plugin-scanner:4776): GLib-GObject-CRITICAL **: g_param_spec_float: assertion 'default_value >= minimum && default_value <= maximum' failed

(gst-plugin-scanner:4776): GLib-GObject-CRITICAL **: g_object_class_install_property: assertion 'G_IS_PARAM_SPEC (pspec)' failed

The http-version property here is initialized with default_value=2.0, min=1.0, max=1.1. Attaching a trivial patch fixing this :)
Comment 1 Philippe Normand 2017-08-06 11:18:33 UTC
Created attachment 357051 [details] [review]
proposed patch
Comment 2 Sebastian Dröge (slomo) 2017-08-06 16:28:00 UTC
Comment on attachment 357051 [details] [review]
proposed patch

Ideally this should just be an enum, not a float. A float makes no sense for this :) Feel free to push your fix, or to fix it properly instead
Comment 3 Philippe Normand 2017-08-06 18:25:27 UTC
Hum doesn't seem so easy to have an enum there because there's both a build-time check and a runtime test. In the mean time I'll push this patch if that's OK :)
Comment 4 Sebastian Dröge (slomo) 2017-08-07 06:03:53 UTC
Why difficult? Just make the HTTP 2 part compile-time in the enum with an #ifdef, and for runtime fall-back to HTTP 1.1 if 2 is selected but not supported :)

But sure, push as-is to make things work better at least. But let's keep this bug open until it's solved properly.
Comment 5 Philippe Normand 2017-08-07 09:30:15 UTC
Created attachment 357092 [details] [review]
updated patch
Comment 6 Philippe Normand 2017-08-07 09:31:08 UTC
Adding Sam. Can you test this on your side please?
Comment 7 Sebastian Dröge (slomo) 2017-08-07 11:23:06 UTC
Review of attachment 357092 [details] [review]:

Looks mostly good to me, thanks :)

::: ext/curl/gstcurlhttpsrc.c
@@ +204,3 @@
   http_env = g_getenv ("GST_CURL_HTTP_VER");
   if (http_env != NULL) {
+    gfloat http_version = (gfloat) g_ascii_strtod (http_env, NULL);

Please don't use floats here, just take the string and use strcmp() for the 3 possibilities :)
Comment 8 Philippe Normand 2017-08-07 12:08:20 UTC
Created attachment 357108 [details] [review]
updated patch
Comment 9 Sam Hurst 2017-08-07 14:55:26 UTC
Just tested this on my side with different versions of libcurl as well as against http/1.1 and h2/h2c servers and Philippe's patch works in all cases.

> Just make the HTTP 2 part compile-time in the enum with an #ifdef, and
> for runtime fall-back to HTTP 1.1 if 2 is selected but not supported :)

If libcurl doesn't support the HTTP version specified, it will fall back to HTTP/1.1 as a default. However, I note that because the libcurl features check has been removed, we get a slightly clunky WARN message in ::_create() when libcurl is >=7.33.0 but not built against nghttp2.

Might be worth a check to see if setting CURL_HTTP_VERSION_2_0 failed due to lack of HTTP/2 support or some bigger underlying libcurl failure (it is possible to build curl without http support...), e.g.

@@ -1008,8 +1003,15 @@ gst_curl_http_src_create_easy_handle (GstCurlHttpSrc * s)
 #ifdef CURL_VERSION_HTTP2
     case GSTCURL_HTTP_VERSION_2_0:
       GST_DEBUG_OBJECT (s, "Setting version as HTTP/2.0");
-      gst_curl_setopt_int (s, handle, CURLOPT_HTTP_VERSION,
-          CURL_HTTP_VERSION_2_0);
+      if (curl_easy_setopt (handle, CURLOPT_HTTP_VERSION,
+              CURL_HTTP_VERSION_2_0) != CURLE_OK) {
+        if (gst_curl_http_src_curl_capabilities->features & CURL_VERSION_HTTP2) {
+          GST_WARNING_OBJECT (s,
+              "Cannot set unsupported option CURLOPT_HTTP_VERSION");
+        } else {
+          GST_INFO_OBJECT (s, "HTTP/2 unsupported by libcurl at this time");
+        }
+      }
       break;
 #endif
     default:
Comment 10 Sam Hurst 2017-08-07 14:57:16 UTC
Created attachment 357122 [details] [review]
updated patch with extra http/2 error checking

An updated patch incorporating the change I proposed above
Comment 11 Philippe Normand 2017-08-07 15:33:47 UTC
Can this go in a patch on top of my original change maybe? Hijacking the authorship of the original patch isn't very nice, imho anyway :)
Comment 12 Sam Hurst 2017-08-07 15:37:35 UTC
Oops, sorry! For some reason I thought that simply amending it wouldn't change the author. I'll split it out as a separate patch now.
Comment 13 Sam Hurst 2017-08-07 15:46:16 UTC
Created attachment 357123 [details] [review]
Add extra http/2 error checking
Comment 14 Philippe Normand 2017-08-07 17:41:18 UTC
Thanks Sam!
Comment 15 Sebastian Dröge (slomo) 2017-08-08 08:01:54 UTC
Review of attachment 357108 [details] [review]:

Looks good to me
Comment 16 Sebastian Dröge (slomo) 2017-08-08 08:02:17 UTC
Review of attachment 357123 [details] [review]:

Also looks good
Comment 17 Philippe Normand 2017-08-08 08:08:08 UTC
commit 6baa66a889624abc15813719d19ec39c68958df7 (HEAD -> master, origin/master, origin/HEAD)
Author: Sam Hurst <Sam.Hurst@bbc.co.uk>
Date:   Mon Aug 7 16:41:27 2017 +0100

    curlhttpsrc: Does version set fail because of HTTP2
    
    Check to see if setting CURL_HTTP_VERSION_2_0 failed due to lack of HTTP/2
    support or some bigger underlying libcurl failure
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785878

commit 5bf092bd64684e4b1f1446c25b07b6771ce97ba6
Author: Philippe Normand <philn@igalia.com>
Date:   Mon Aug 7 10:25:17 2017 +0100

    curlhttpsrc: set http-version class property as enum
    
    This matches better with the preferred_http_version which was already declared
    as enum.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785878