Issue 20380 - std.net.curl: misbehaviour on arch 'arm32v7 gnueabihf' (Raspberry/Raspbian/Buster)
Summary: std.net.curl: misbehaviour on arch 'arm32v7 gnueabihf' (Raspberry/Raspbian/Bu...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All Linux
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on: 19367
Blocks:
  Show dependency treegraph
 
Reported: 2019-11-10 17:34 UTC by Carsten Schlote
Modified: 2020-08-03 15:29 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Carsten Schlote 2019-11-10 17:34:29 UTC
Tried to do this:
'''
import std.net.curl;
import std.stdio;

void main()
{
    auto data = get("https://acme-staging-v02.api.letsencrypt.org/directory");
    writeln(data);
}
'''
Works fine on intel, but crashes on Raspberry:
```
pi@raspi4:~/builds $ ./curldownload-gdc 
std.net.curl.HTTPStatusException@/usr/lib/gcc/arm-linux-gnueabihf/8/include/d/std/net/curl.d(1050): HTTP request returned status code 0 ()
----------------
0xb6d29723 pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy object.Throwable)
	???:0
0x18fb3 char[] std.net.curl._basicHTTP!(char)._basicHTTP(const(char)[], const(void)[], std.net.curl.HTTP)
	/usr/lib/gcc/arm-linux-gnueabihf/8/include/d/std/net/curl.d:1050
0x16f63 char[] std.net.curl.get!(std.net.curl.HTTP, char).get(const(char)[], std.net.curl.HTTP)
	/usr/lib/gcc/arm-linux-gnueabihf/8/include/d/std/net/curl.d:540
0x166ab char[] std.net.curl.get!(std.net.curl.AutoProtocol, char).get(const(char)[], std.net.curl.AutoProtocol)
	/usr/lib/gcc/arm-linux-gnueabihf/8/include/d/std/net/curl.d:552
0x165d3 _Dmain
	/home/pi/builds/curldownload.d:7
0xb6abc157 ???
	???:0
0xb6abc453 ???
	???:0
0xb6abc933 ???
	???:0
0xb6abc453 ???
	???:0
0xb6abc643 _d_run_main
	???:0
0x1658f main
	/usr/lib/gcc/arm-linux-gnueabihf/8/include/d/__entrypoint.di:44
0xb67ef717 __libc_start_main
	/build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
pi@raspi4:~/builds $ ./curldownload
std.net.curl.HTTPStatusException@/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/net/curl.d(1083): HTTP request returned status code 0 ()
----------------
exception.d:455 pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy object.Throwable) [0x24c8b]
curldownload.d:1083 [0x2ccf7]
curldownload.d:562 [0x1f347]
curl.d:574 [0x1ee9f]
curldownload.d:7 [0x1edf3]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0xb6ab1b17]
??:? _d_run_main [0xb6ab18af]
__entrypoint.d:8 [0x32f43]
??:? __libc_start_main [0xb67dc717]
```

Compilers:
gdc 8.3
ldc 1.12.0
Comment 1 berni44 2019-12-17 09:06:36 UTC
Could reproduce this on intel too with dmd.
Comment 2 Carsten Schlote 2019-12-17 13:17:42 UTC
pi@raspi4:~/builds2 $ dpkg --status libcurl4 | grep Version
Version: 7.64.0-4

Fails with both GDC and LDC2.

joe@ubuntu-desktop:~/build/dlang$ dpkg --status libcurl4 | grep Version
Version: 7.58.0-2ubuntu3.8

Works for all compilers.

Maybe a problem with libcurl bindings? Or a bug with libcurl?
Comment 3 berni44 2019-12-17 14:43:04 UTC
Maybe. I've got 7.64.0-4 too. (Debian stable)
Comment 4 Carsten Schlote 2020-01-03 20:09:20 UTC
I recompiled libcurl 7.64.0 from source with debug symbols enabled, and copied the result over the binary provided by raspbian. 

The problem is now gone. 

So either the Raspbian maintainers messed something up, or something else is broken.
Comment 5 Carsten Schlote 2020-04-30 15:12:33 UTC
The problem still exists on 'focal fossa' ARM64 running on a raspberry4b.

$ uname -a
Linux raspi4 5.4.0-1008-raspi #8-Ubuntu SMP Wed Apr 8 11:13:06 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal

$ curl --version
curl 7.68.0 (aarch64-unknown-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

$ dub upgrade -v
Using dub registry url 'https://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/cschlote/.dub/packages/local-packages.json
Looking for local package map at /home/cschlote/build/dlang/lzd/.dub/packages/local-packages.json
Determined package version using GIT: lzd 0.3.4+commit.3.g1026347
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/cschlote/.dub/packages/local-packages.json
Looking for local package map at /home/cschlote/build/dlang/lzd/.dub/packages/local-packages.json
  Version selection for dependency silly (silly) of lzd is missing.
  Missing dependency silly ~>1.0.2 of lzd
Upgrading project in /home/cschlote/build/dlang/lzd
Search for versions of silly (1 package suppliers)
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback package supplier registry at https://code-mirror.dlang.io/ failed with 'Failed to download https://code-mirror.dlang.io/api/packages/infos?packages=%5B%22silly%22%5D&include_dependencies=true&minimize=true'.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Package supplier registry at https://code.dlang.org/ failed with 'HTTP request returned status code 0 ()', trying fallbacks.
Fallback registry at https://dub-registry.herokuapp.com/ succeeded
Return for silly: [0.8.2, 0.8.1, 0.8.0, 0.7.1, 0.7.0, 0.6.0, 0.5.0, 0.4.3, 0.4.2, 0.4.1, 0.4.0, 0.3.0, 0.2.1, 0.2.0, 0.1.1, 0.1.0, 0.0.2, 0.0.1, 0.7.0-alpha, ~master]
Unresolvable dependencies to package silly:
  lzd 0.3.4+commit.3.g1026347 depends on silly ~>1.0.2

That is broken: Version 1.0.2 exists. Also a return value of 0 shouldn't happen here.

This works all fine on the 'focal fossa' and intel architecture.
Comment 6 Carsten Schlote 2020-05-01 07:53:42 UTC
It(In reply to Carsten Schlote from comment #5)
> The problem still exists on 'focal fossa' ARM64 running on a raspberry4b.

The problem exists with gdc from the standard Ubuntu repository.

$ gdc --version
gdc (Ubuntu 10-20200411-0ubuntu1) 10.0.1 20200411 (experimental) [master revision bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566]
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However, with LDC2 compiled from sources directly (using gdc a D compiler for build), it is working.

$ ldc2 --version
LDC - the LLVM D compiler (1.20.1):
  based on DMD v2.090.1 and LLVM 10.0.0
  built with LDC - the LLVM D compiler (1.20.1)
  Default target: aarch64-unknown-linux-gnu
  Host CPU: cortex-a72
  http://dlang.org - http://wiki.dlang.org/LDC
Comment 7 Iain Buclaw 2020-05-01 16:20:52 UTC
Duplicate of 19367
Comment 8 Iain Buclaw 2020-08-03 13:26:40 UTC
GCC 10.2 is out https://gcc.gnu.org/gcc-10/
Comment 9 Iain Buclaw 2020-08-03 15:29:41 UTC
(In reply to Iain Buclaw from comment #8)
> GCC 10.2 is out https://gcc.gnu.org/gcc-10/

Changelog entry for std.net.curl change:

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libphobos/ChangeLog;h=bf6eefd3bd1a8b300d9993e253a90679575fc4be;hb=ee5c3db6c5b2c3332912fb4c9cfa2864569ebd9a#l1

Built and ran dub on aarch64 server, issue no longer occurs.