Bug 264158 - devel/pkconf: loop forever in Haskell package
Summary: devel/pkconf: loop forever in Haskell package
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-22 20:43 UTC by Alexis Praga
Modified: 2023-09-01 14:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis Praga 2022-05-22 20:43:08 UTC
Hi,

I've discovered running `cabal install` for Haskell programmes takes a very long time, for example `xmonad`.

With the help of @arrowd, here is a minimal reproducible example.

1. Run `make` in /usr/ports/devel/hs-ormolu
2. pkg-config takes a lot of CPU
  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
19887 root          1  89    0    13M  3156K CPU0     0   0:09 100.23% pkgconf
3. Running the command by hand is fast but inside make, it seems to be stuck.
4. Enable debug flags of `pkgconf` and get a backtrace:

----
#0  0x00000008003c1985 in memset () from /lib/libc.so.7
#1  0x0000000800385822 in snprintf () from /lib/libc.so.7
#2  0x0000000800258455 in pkgconf_trace (client=0x20d488 <pkg_client>, filename=0x8002537a9 "libpkgconf/pkg.c", lineno=1346, 
    funcname=0x800252fed "pkgconf_pkg_t *pkgconf_pkg_verify_dependency(pkgconf_client_t *, pkgconf_dependency_t *, unsigned int *)", format=0x8002543ff "trying to verify dependency: %s")
    at libpkgconf/client.c:379
#3  0x000000080025aa03 in pkgconf_pkg_verify_dependency (client=0x20d488 <pkg_client>, pkgdep=0x800a37f70, eflags=0x7ffffffe7174) at libpkgconf/pkg.c:1346
#4  0x000000080025b24b in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a3b580, deplist=0x800a3b638, func=0x0, data=0x0, depth=1986, skip_flags=0) at libpkgconf/pkg.c:1455
#5  0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a3b580, func=0x0, data=0x0, maxdepth=1986, skip_flags=0) at libpkgconf/pkg.c:1581
#6  0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a6e180, deplist=0x800a6e238, func=0x0, data=0x0, depth=1987, skip_flags=0) at libpkgconf/pkg.c:1481
#7  0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a6e180, func=0x0, data=0x0, maxdepth=1987, skip_flags=0) at libpkgconf/pkg.c:1581
#8  0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a6e000, deplist=0x800a6e0b8, func=0x0, data=0x0, depth=1988, skip_flags=0) at libpkgconf/pkg.c:1481
#9  0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a6e000, func=0x0, data=0x0, maxdepth=1988, skip_flags=0) at libpkgconf/pkg.c:1581
#10 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a70280, deplist=0x800a70338, func=0x0, data=0x0, depth=1989, skip_flags=0) at libpkgconf/pkg.c:1481
#11 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a70280, func=0x0, data=0x0, maxdepth=1989, skip_flags=0) at libpkgconf/pkg.c:1581
#12 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a6f500, deplist=0x800a6f5b8, func=0x0, data=0x0, depth=1990, skip_flags=0) at libpkgconf/pkg.c:1481
#13 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a6f500, func=0x0, data=0x0, maxdepth=1990, skip_flags=0) at libpkgconf/pkg.c:1581
#14 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a89f00, deplist=0x800a89fb8, func=0x0, data=0x0, depth=1991, skip_flags=0) at libpkgconf/pkg.c:1481
#15 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a89f00, func=0x0, data=0x0, maxdepth=1991, skip_flags=0) at libpkgconf/pkg.c:1581
#16 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a89180, deplist=0x800a89238, func=0x0, data=0x0, depth=1992, skip_flags=0) at libpkgconf/pkg.c:1481
#17 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a89180, func=0x0, data=0x0, maxdepth=1992, skip_flags=0) at libpkgconf/pkg.c:1581
#18 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800aa6680, deplist=0x800aa6738, func=0x0, data=0x0, depth=1993, skip_flags=0) at libpkgconf/pkg.c:1481
#19 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800aa6680, func=0x0, data=0x0, maxdepth=1993, skip_flags=0) at libpkgconf/pkg.c:1581
#20 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800aa6380, deplist=0x800aa6438, func=0x0, data=0x0, depth=1994, skip_flags=0) at libpkgconf/pkg.c:1481
#21 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800aa6380, func=0x0, data=0x0, maxdepth=1994, skip_flags=0) at libpkgconf/pkg.c:1581
#22 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a70e80, deplist=0x800a70f38, func=0x0, data=0x0, depth=1995, skip_flags=0) at libpkgconf/pkg.c:1481
#23 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a70e80, func=0x0, data=0x0, maxdepth=1995, skip_flags=0) at libpkgconf/pkg.c:1581
#24 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800a70d00, deplist=0x800a70db8, func=0x0, data=0x0, depth=1996, skip_flags=0) at libpkgconf/pkg.c:1481
#25 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800a70d00, func=0x0, data=0x0, maxdepth=1996, skip_flags=0) at libpkgconf/pkg.c:1581
#26 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800ac9800, deplist=0x800ac98b8, func=0x0, data=0x0, depth=1997, skip_flags=0) at libpkgconf/pkg.c:1481
#27 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800ac9800, func=0x0, data=0x0, maxdepth=1997, skip_flags=0) at libpkgconf/pkg.c:1581
#28 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800aca400, deplist=0x800aca4b8, func=0x0, data=0x0, depth=1998, skip_flags=0) at libpkgconf/pkg.c:1481
#29 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800aca400, func=0x0, data=0x0, maxdepth=1998, skip_flags=0) at libpkgconf/pkg.c:1581
#30 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x800ac9380, deplist=0x800ac9438, func=0x0, data=0x0, depth=1999, skip_flags=0) at libpkgconf/pkg.c:1481
#31 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x800ac9380, func=0x0, data=0x0, maxdepth=1999, skip_flags=0) at libpkgconf/pkg.c:1581
#32 0x000000080025b345 in pkgconf_pkg_walk_list (client=0x20d488 <pkg_client>, parent=0x7ffffffe7dd8, deplist=0x7ffffffe7e90, func=0x0, data=0x0, depth=2000, skip_flags=0) at libpkgconf/pkg.c:1481
#33 0x000000080025ae30 in pkgconf_pkg_traverse (client=0x20d488 <pkg_client>, root=0x7ffffffe7dd8, func=0x0, data=0x0, maxdepth=2000, skip_flags=0) at libpkgconf/pkg.c:1581
#34 0x000000080025ac9e in pkgconf_pkg_verify_graph (client=0x20d488 <pkg_client>, root=0x7ffffffe7dd8, depth=2000) at libpkgconf/pkg.c:1399
#35 0x0000000800260b1c in pkgconf_queue_verify (client=0x20d488 <pkg_client>, world=0x7ffffffe7dd8, list=0x7ffffffe8090, maxdepth=2000) at libpkgconf/queue.c:116
#36 0x0000000800260bd6 in pkgconf_queue_validate (client=0x20d488 <pkg_client>, list=0x7ffffffe8090, maxdepth=2000) at libpkgconf/queue.c:189
#37 0x0000000000206ea2 in main (argc=1147, argv=0x7fffffff8880) at cli/main.c:1308
---

5. Continuing the execution and get a backtrace again result in the same thing.

My configuration:
- FreeBSD 13.0-RELEASE-p11
- ghc 8.10.7 and cabal-install 3.6.0.0 (from the ports tree)

Thanks !
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2022-07-27 21:11:57 UTC
I can't reproduce this on a fresh 14-CURRENT system and fresh Ports tree.

Alexis, can you check if this is still an issue for you? Make sure to use supported FreeBSD version and recent Ports tree.
Comment 2 Alexis Praga 2022-07-30 11:50:06 UTC
Thanks for the feedback. I've updated my system to 14.1-RELEASE-p0 and the latest port tree. For haskell
- ghc 9.2.4
- cabal 3.6.2.0
The issue persists on my end unfortunately.
Comment 3 Alexis Praga 2022-07-30 11:51:26 UTC
Sorry, I meand 13.1-RELEASE.
Comment 4 Gleb Popov freebsd_committer freebsd_triage 2022-08-01 17:51:34 UTC
Do you use official binary packages or compile packages yourself? If latter, do you have something in /etc/make.conf ?
Comment 5 Alexis Praga 2022-08-01 19:50:02 UTC
(In reply to Gleb Popov from comment #4)
No, I'm using the binaries from pkg.

In /etc/make.conf, I had DEVELOPER=yes but removing it, deinstalling ghc and cabal-install and re-installing it did not solve the issue.
The other line is :
DEFAULT_VERSIONS+=ssl=openssl

If you have any more ideas, I would be happy to test them.
Comment 6 Oleg Sidorkin 2022-08-02 00:47:07 UTC
It doesn't hang. It just works really slow (take few minutes to calculate cflags for grpc libs in my case).
Upstream issue: https://github.com/pkgconf/pkgconf/issues/229 (claimed to be fixed, however not released)
Comment 7 Gleb Popov freebsd_committer freebsd_triage 2022-08-03 12:20:37 UTC
I wonder if this is the same issue? https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265542
Comment 8 Oleg Sidorkin 2022-08-03 12:36:26 UTC
(In reply to Gleb Popov from comment #7)
I'm 99.9% sure
Comment 9 Gleb Popov freebsd_committer freebsd_triage 2023-09-01 14:41:29 UTC
pkgconf 2.0.2 landed. Does this issue still persist?