Bug 282137 - devel/apr1: proxy_fcgi:error after updating to 1.7.5
Summary: devel/apr1: proxy_fcgi:error after updating to 1.7.5
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-apache (Nobody)
URL: https://bz.apache.org/bugzilla/show_b...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-16 10:36 UTC by Tomáš Čiernik
Modified: 2024-11-16 11:28 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (apache)


Attachments
Fix poll(2) usage (543 bytes, patch)
2024-11-15 22:47 UTC, Jung-uk Kim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomáš Čiernik 2024-10-16 10:36:29 UTC
Hello,

on FreeBSD 13.4 after updating apr1 to version 1.7.5, bareos-webui is not able to authenticate user. Apache throws error "[proxy_fcgi:error] [pid 8084:tid 35662020608] (22)Invalid argument: [remote IP.AD.DR.ES:48532] AH01075: Error dispatching request to : (sending stdin), referer: https://example.com/auth/login

It seems there is also some weird behavior with nextcloud, unfortunately not reproducible (I was unable to upload some files, but it had nothing with size or type).

After downgrading to 1.7.3, everything started working.

Apache version is 2.4.62 with MPM_PREFORK disabled in favour of MPM_EVENT, but reverting it makes no change.
Comment 1 Guus Teley 2024-10-30 14:11:12 UTC
I may add to this the following:
https://forums.freebsd.org/threads/apache-2-4-reverse-proxy-error-22-invalid-argument.95429/
Not fcgi, but the same error.
Reverting to previous version solved it.
Comment 2 Tomáš Čiernik 2024-10-31 16:07:01 UTC
After some investigation I figured out suspicious behavior on TimeOut declaration. After decrease its value to 2147 proxy_fcgi error disappeared.
Comment 3 Bernard Spil freebsd_committer freebsd_triage 2024-11-10 11:50:07 UTC
"decrease TimeOut value to 2147" is the fix
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2024-11-15 20:46:32 UTC
"decrease TimeOut value to 2147" is just a workaround.
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2024-11-15 20:53:39 UTC
I experienced a similar problem and I found the following upstream PR:

https://bz.apache.org/bugzilla/show_bug.cgi?id=69410

I started bisecting commits to find the culprit and I found reverting this commit fixes my problem:

https://svn.apache.org/viewvc?view=revision&revision=1909335

This patch to be specific:

https://svn.apache.org/viewvc/apr/apr/branches/1.7.x/support/unix/waitio.c?r1=1909335&r2=1909334&view=patch

I believe the upstream patch is correct but it causes regressions for certain applications, which depend on the previous (mis)behavior, i.e., waiting forever rather than failing almost immediately.
Comment 6 Jung-uk Kim freebsd_committer freebsd_triage 2024-11-15 22:47:04 UTC
Created attachment 255205 [details]
Fix poll(2) usage

To my surprise, this patch was enough to fix the problem for me.

It seems APR follows Linux poll() behavior, i.e., if timeout is negative, it is infinite.  We do not allow any negative timeout other than INFTIM(-1).  It seems POSIX does not define this.

https://man7.org/linux/man-pages/man2/poll.2.html
https://pubs.opengroup.org/onlinepubs/009696799/functions/poll.html
Comment 7 commit-hook freebsd_committer freebsd_triage 2024-11-16 11:24:17 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=efc00d9fd418d84a1f88c3b74a2d07bd41df7f91

commit efc00d9fd418d84a1f88c3b74a2d07bd41df7f91
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2024-11-16 11:20:26 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2024-11-16 11:20:26 +0000

    devel/apr1: Fix poll(2) timeout issue

    Fix by jkim

    PR:             282137
    Reported by:    Tomáš Čiernik <tomas ciernik sk>

 devel/apr1/Makefile                                |  2 +-
 devel/apr1/files/patch-support_unix_waitio.c (new) | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
Comment 8 Bernard Spil freebsd_committer freebsd_triage 2024-11-16 11:28:44 UTC
Thanks for providing the solution jkim!