Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Oct 2022 02:19:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 266808] www/obhttpd has various issues in both pkg and ports
Message-ID:  <bug-266808-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266808

            Bug ID: 266808
           Summary: www/obhttpd has various issues in both pkg and ports
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: freebsd@kumba.dev
                CC: koue@chaosophia.net
             Flags: maintainer-feedback?(koue@chaosophia.net)
                CC: koue@chaosophia.net

Summary, there are three issues:
1. obhttpd from pkg needs OpenBSD libevent, but this is not auto-fulfilled
2. Using libevent-2.1.12 will cause a SIGSEGV signal 11 crash
3. Compiling from ports doesn't work because of weird way it includes OpenB=
SD
libs during build

Long detail:
Running obhttpd-7.1.20220923_1 from pkg in a jail, using a minimal config f=
ile
to listen only on TCP/80 for IPv4 and IPv6, when I attempt to connect to the
server, the server process (not the logger process) will crash with a SIGSE=
GV
signal 11:

Sample obhttpd.conf (site name redacted):

> chroot "/srv/www"
> prefork 1
>=20
> server "www.foo" {
>         listen on <IPv4> port 80
>         listen on <IPv6> port 80
>         gzip-static
>         root "/htdocs"
>         directory auto index
>=20
>         tcp {
>                 nodelay
>                 sack
>         }
> }

Running obhttpd directly in the foreground, undaemonized:
# /usr/local/sbin/obhttpd -f /usr/local/etc/obhttpd.conf -d
startup
logger exiting, pid 44521
lost child: pid 44302 terminated; signal 11
parent terminating, pid 44121

The point between "startup" and "logger exiting" is where the crash happens=
.=20
Here is the output of truss on the server PID (I already tested the logger =
PID
and it exits fine).  Server name changed for privacy (and offsets adjusted):
> # truss -a -f -e -p 44302
> 44302: kevent(4,{ },0,{ 6,EVFILT_READ,0x0,0,0x1,0x30303 },64,0x0) =3D 1 (=
0x1)
> 44302: __sysctl("kern.proc.nfds.0",4,0x820cc998c,0x820cc9980,0x0,0) =3D 0=
 (0x0)
> 44302: getdtablesize()                           =3D 466434 (0x71e02)
> 44302: accept4(0x6,0x820cc9a28,0x820cc9a24,0x20000000) =3D 8 (0x8)
> 44302: getpid()                                  =3D 44302 (0xad0e)
> 44302: getsockname(8,{ AF_INET <IPv4>:80 },0x820cc9a24) =3D 0 (0x0)
> 44302: getsockopt(8,SOL_SOCKET,SO_SNDBUF,0x8274b75d8,0x820cc99d4) =3D 0 (=
0x0)
> 44302: kevent(4,{ 6,EVFILT_READ,EV_ADD,0,0,0x30303 8,EVFILT_READ,EV_ADD,0=
,0,0x30303 8,EVFILT_WRITE,EV_ADD,0,0,0x30303 },3,{ 8,EVFILT_READ,0x0,0,0x16=
7,0x30303 8,EVFILT_WRITE,0x0,0,0x8c00,0x30303 },64,{ 60.000000000 }) =3D 2 =
(0x2)
> 44302: ioctl(8,FIONREAD,0x820cc9a20)             =3D 0 (0x0)
> 44302: readv(8,[{"GET / HTTP/1.1\r\nHost: www.foo"...,359}],1) =3D 359 (0=
x167)
> 44302: SIGNAL 11 (SIGSEGV) code=3DSEGV_MAPERR trapno=3D12 addr=3D0xe1f41

My thinking is it has to do with libevent.  It looks like obhttpd relies on
using the libevent from OpenBSD, but when installing from pkg and not ports,
there is no dependency on a FreeBSD package containing OpenBSD's version of
libevent.so.  When I first ran into this, not realizing it needed OpenBSD's
version, I installed libevent-2.1.12 from pkg, which is NOT the one from
OpenBSD, and I think this is the source of the above crash.

When I went to dig into this one, it looks like the obhttpd port pulls down
OpenBSD copies of libevent and libimsg from the obhttpd maintainer's github=
 and
builds them in the same work directory as obhttpd.  However, trying to build
the current version in ports fails because it wants to include an "imsg.h"
header (which should be provided by libimsg, but the include paths aren't s=
et
right, I assume).  One can partially satisfy that by installing libopenbsd,
which looks to be unmaintained, but obhttpd fails to compile again looking =
for
tls.h (from libressl I think).  I gave up at this point, as this does not
appear to be a pkg/port that is straight-forward to install and use.

Small snippet of the build failure from a single .c file:
>--- config.o ---
>cc  -O2 -pipe -fno-strict-aliasing -Wall -I/usr/ports/www/obhttpd/work/htt=
pd-7.1.20220923/src/usr.sbin/httpd -Wstrict-prototypes -Wmissing-prototypes=
 -Wmissing-declarations -Wshadow -Wpointer-arith -Wsign-compare -Wcast-qual=
 -I/usr/ports/www/obhttpd/work/httpd-7.1.20220923/src/usr.sbin/httpd/../../=
../libevent/src/lib/libevent  -I/usr/ports/www/obhttpd/work/httpd-7.1.20220=
923/src/usr.sbin/httpd/../../../libimsg/src/lib/libutil  -I/usr/ports/www/o=
bhttpd/work/httpd-7.1.20220923/src/usr.sbin/httpd/../../include  -I /usr/lo=
cal/include -D__dead=3D''  -DHAVE_CONFIG_H -march=3Dnative  -MD  -MF.depend=
.config.o -MTconfig.o -std=3Dgnu99 -Wno-format-zero-length -nobuiltininc -i=
dirafter /usr/lib/clang/13.0.0/include -fstack-protector-strong    -Qunused=
-arguments    -c config.c -o config.o
>
>--- config.o ---
>config.c:31:10: fatal error: 'imsg.h' file not found
>#include <imsg.h>
>         ^~~~~~~~

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-266808-7788>