logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Simple apache auth module not flushing on ARM hardware
Author
momenaa@yahoo.com



Joined: 06 Apr 2024
Posts: 5
Location: US

PostPosted: Sat 06 Apr '24 20:45    Post subject: Simple apache auth module not flushing on ARM hardware Reply with quote

Hello,
I have a apache auth module that does authentication and then some work. It works fine on all platforms except ARM. Using curl. I am seeing initial client/server handshake etc works fine, but it never flushes until I get FIN from client. Then it sends all data. But by that time client already closed it. So curl hangs. Even this simple function isn't working:
int auth_handler(request_rec *rec)
{
rec->content_type = "text/html";
ap_rputs("The end of the response.<br/>", rec);
ap_rflush(rec); // Flush the output buffer
return OK;
}
The command I am sending is :
curl --basic --user u1k_1:Cisco123 --location-trusted https://cnn.com --connect-timeout 60 --verbose --max-time 120

Here is the part of the log:
CPLG: 04-06 17:55:45 [Sat .614870 2024] [http:trace3] [pid 28745:tid 70369166102800] http_filters.c(1124): [client 169.254.0.91:39362] Response sent with status 200, headers:
CPLG: 04-06 17:55:45 [Sat .614879 2024] [http:trace5] [pid 28745:tid 70369166102800] http_filters.c(1133): [client 169.254.0.91:39362] Date: Sat, 06 Apr 2024 17:55:45 GMT
CPLG: 04-06 17:55:45 [Sat .614893 2024] [http:trace5] [pid 28745:tid 70369166102800] http_filters.c(1136): [client 169.254.0.91:39362] Server: Apache
CPLG: 04-06 17:55:45 [Sat .614902 2024] [http:trace4] [pid 28745:tid 70369166102800] http_filters.c(954): [client 169.254.0.91:39362] Transfer-Encoding: chunked
CPLG: 04-06 17:55:45 [Sat .614910 2024] [http:trace4] [pid 28745:tid 70369166102800] http_filters.c(954): [client 169.254.0.91:39362] Content-Type: text/html
CPLG: 04-06 17:55:45 [Sat .614919 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(1657): [client 169.254.0.91:39362] coalesce: have 0 bytes, adding 125 more
CPLG: 04-06 17:55:45 [Sat .614932 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(1657): [client 169.254.0.91:39362] coalesce: have 125 bytes, adding 35 more
CPLG: 04-06 17:55:45 [Sat .614941 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(1718): [client 169.254.0.91:39362] coalesce: passing on 160 bytes
CPLG: 04-06 17:55:45 [Sat .614971 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(575): [client 169.254.0.91:39362] brigade contains: bytes: 182, non-file bytes: 182, eor buckets: 0, morphing buckets: 0
CPLG: 04-06 17:55:45 [Sat .614982 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(2207): [client 169.254.0.91:39362] OpenSSL: write 182/182 bytes to BIO#400020004c50 [mem: 4000200199f3] (BIO dump follows)
CPLG: 04-06 17:55:45 [Sat .614992 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2134): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:55:45 [Sat .615007 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0000: 17 03 03 00 b1 1b 9d 25-01 80 54 fb 54 ef 28 a1 .......%..T.T.(. |
CPLG: 04-06 17:55:45 [Sat .615021 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0010: 46 89 4f f0 e0 27 5d d8-45 47 82 94 7d 66 cd 01 F.O..'].EG..}f.. |
CPLG: 04-06 17:55:45 [Sat .615035 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0020: dc 39 b3 28 8e 81 92 82-b1 46 19 31 41 5d c3 80 .9.(.....F.1A].. |
CPLG: 04-06 17:55:45 [Sat .615049 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0030: a6 48 8b 24 05 4d 74 25-36 21 46 cc 6a d0 4a 41 .H.$.Mt%6!F.j.JA |
CPLG: 04-06 17:55:45 [Sat .615063 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0040: 26 e3 48 33 94 90 d6 87-df 7b 48 dc 87 22 11 cf &.H3.....{H..".. |
CPLG: 04-06 17:55:45 [Sat .615078 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0050: 9e 6d c8 d9 79 1d 88 77-ec cf a8 68 9c 2c 31 08 .m..y..w...h.,1. |
CPLG: 04-06 17:55:45 [Sat .615092 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0060: f3 59 bc 5b 65 8c 99 39-76 96 46 1a 58 c8 aa f1 .Y.[e..9v.F.X... |
CPLG: 04-06 17:55:45 [Sat .615106 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0070: ab 82 82 82 cb f2 5a 46-ee 2d d8 4c a6 4f 4c e3 ......ZF.-.L.OL. |
CPLG: 04-06 17:55:45 [Sat .615119 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0080: c1 88 c8 3c 31 f8 43 ac-eb f2 ef a5 d3 87 2d 61 ...<1.C.......-a |
CPLG: 04-06 17:55:45 [Sat .615133 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0090: ae e1 6a 84 6a 07 9e 0a-c0 8c 15 5e c3 13 9b 83 ..j.j......^.... |
CPLG: 04-06 17:55:45 [Sat .615147 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 00a0: 8e 57 22 aa 6c af cf 60-4e 20 8e e9 b5 1e 97 d5 .W".l..`N ...... |
CPLG: 04-06 17:55:45 [Sat .615224 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 00b0: 59 a3 21 46 e0 42 Y.!F.B |
CPLG: 04-06 17:55:45 [Sat .615261 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2178): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:55:45 [Sat .615271 2024] [core:trace6] [pid 28745:tid 70369166102800] core_filters.c(524): [client 169.254.0.91:39362] will flush because of FLUSH bucket
CPLG: 04-06 17:55:45 [Sat .615278 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(526): [client 169.254.0.91:39362] seen in brigade so far: bytes: 182, non-file bytes: 182, eor buckets: 0, morphing buckets: 0
CPLG: 04-06 17:55:45 [Sat .615287 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(553): [client 169.254.0.91:39362] flushing now
CPLG: 04-06 17:55:45 [Sat .615325 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(567): [client 169.254.0.91:39362] total bytes written: 2462
CPLG: 04-06 17:55:45 [Sat .615334 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(575): [client 169.254.0.91:39362] brigade contains: bytes: 0, non-file bytes: 0, eor buckets: 0, morphing buckets: 0
CPLG: 04-06 17:55:45 [Sat .615360 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(575): [client 169.254.0.91:39362] brigade contains: bytes: 27, non-file bytes: 27, eor buckets: 0, morphing buckets: 0
CPLG: 04-06 17:55:45 [Sat .615370 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(2207): [client 169.254.0.91:39362] OpenSSL: write 27/27 bytes to BIO#400020004c50 [mem: 4000200199f3] (BIO dump follows)
CPLG: 04-06 17:55:45 [Sat .615380 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2134): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:55:45 [Sat .615394 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0000: 17 03 03 00 16 42 b2 4f-7b 6e d4 28 24 ef dc e6 .....B.O{n.($... |
CPLG: 04-06 17:55:45 [Sat .615408 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0010: ba 11 7d 6d 46 ac 85 d0-06 22 54 ..}mF...."T |
CPLG: 04-06 17:55:45 [Sat .615415 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2178): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:55:45 [Sat .615424 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(575): [client 169.254.0.91:39362] brigade contains: bytes: 27, non-file bytes: 27, eor buckets: 0, morphing buckets: 0
CPLG: 04-06 17:55:45 [Sat .615435 2024] [core:trace8] [pid 28745:tid 70369166102800] core_filters.c(575): [client 169.254.0.91:39362] brigade contains: bytes: 27, non-file bytes: 27, eor buckets: 1, morphing buckets: 0

Then I do not see anything until 120 sec passed and FIN is received from client. pcap shows now it is sending rest of the data.
CPLG: 04-06 17:57:43 [Sat .541667 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(2207): [client 169.254.0.91:39362] OpenSSL: read 5/5 bytes from BIO#400020007d20 [mem: 4000200199f3] (BIO dump follows)
CPLG: 04-06 17:57:43 [Sat .541761 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2134): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:57:43 [Sat .541787 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0000: 17 03 03 00 13 ..... |
CPLG: 04-06 17:57:43 [Sat .541799 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2178): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:57:43 [Sat .541816 2024] [ssl:trace4] [pid 28745:tid 70369166102800] ssl_engine_io.c(2207): [client 169.254.0.91:39362] OpenSSL: read 19/19 bytes from BIO#400020007d20 [mem: 4000200199f8] (BIO dump follows)
CPLG: 04-06 17:57:43 [Sat .541827 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2134): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
CPLG: 04-06 17:57:43 [Sat .541866 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0000: 01 a1 dc ea e9 55 1e d2-60 84 93 97 e3 f2 69 b9 .....U..`.....i. |
CPLG: 04-06 17:57:43 [Sat .541880 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2173): [client 169.254.0.91:39362] | 0010: 53 fe 5d S.] |
CPLG: 04-06 17:57:43 [Sat .541887 2024] [ssl:trace7] [pid 28745:tid 70369166102800] ssl_engine_io.c(2178): [client 169.254.0.91:39362] +-------------------------------------------------------------------------+
...
...

I do not know why it is different at ARM platform. Same code works with other hardware.
Any help would be appreciated.

Apache version: 2.4.43
os: Wind River Linux LTS 21.20 Update 12
Hardware: ARM
TLS version 1.3
Back to top
momenaa@yahoo.com



Joined: 06 Apr 2024
Posts: 5
Location: US

PostPosted: Mon 08 Apr '24 22:05    Post subject: Reply with quote

Any pointers, any one? I am really stuck here. Not sure which way to go. Any help would be appreciated
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 315
Location: UK

PostPosted: Tue 09 Apr '24 13:16    Post subject: Reply with quote

This does rather sound like some vaguary of this TCP stack on the ARM platform,

In your simple test function, what happens if you check the return value from ap_rflush(). If it's zero, then it suggests the APR library was happy, and you need to look further down the stack to the OS.

Although you might have more content to return to the client, out of interest what happens if you add a call ap_finalize_request_protocol() after your ap_rflush()?
Back to top
momenaa@yahoo.com



Joined: 06 Apr 2024
Posts: 5
Location: US

PostPosted: Sat 13 Apr '24 2:46    Post subject: Reply with quote

Sorry was unable to check the response. I will try those soon. Thank you.
Back to top
momenaa@yahoo.com



Joined: 06 Apr 2024
Posts: 5
Location: US

PostPosted: Sun 14 Apr '24 19:03    Post subject: Reply with quote

I tried all that you suggested. ap_rflush() returns 0. Also adding finalize didn't make any difference, still waiting until it gets FIN.
Back to top
momenaa@yahoo.com



Joined: 06 Apr 2024
Posts: 5
Location: US

PostPosted: Mon 15 Apr '24 2:36    Post subject: Reply with quote

It does not seem to be ssl related. Because I used non-ssl flow (apache serveris running without ssl) and still seeing similar problem. I see response coming to client only after max-time expires and client send a FIN. So something to be in TCP/OS level in ARM? Note here that when I ran with a plain python openssl server, it worked fine.
Back to top


Reply to topic   Topic: Simple apache auth module not flushing on ARM hardware View previous topic :: View next topic
Post new topic   Forum Index -> Apache