View Issue Details

IDProjectCategoryView StatusLast Update
0034828mantisbtotherpublic2025-03-01 18:40
Reporterc_schmitz Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.26.4 
Target Version2.27.1Fixed in Version2.27.1 
Summary0034828: HTTP response code not set on errors when using FastCGI
Description

The error code is not set when the web server runs on FastCGI, as reported by @c_schmitz in 0034634:0069314

in function html_end a call to fastcgi_finish_request() is made, which causes the process to be finished.
So it never gets to send the header - it probably needs to be sent earlier.

TagsNo tags attached.

Relationships

related to 0034634 closeddregad Non-existing issue number does not throw a 404 in the UI 
related to 0017458 closeddregad SOAP API does not send e-mails 
related to 0017460 closeddregad Email notifications are sent in batches 

Activities

dregad

dregad

2024-10-07 11:08

developer   ~0069316

The fastcgi_finish_request() call was introduced in commit MantisBT master cea405cc, which claims Performance optimisation for users not using email send via cron jobs and using php-fpm

The change is unfortunately not linked to a bugtracker issue, but my guess is that this call is no longer needed - or at least not in this function. Back when it was introduced, html_end() was calling email_send_all(), but nowadays this is managed via a shutdown function (see 0017460).

dregad

dregad

2024-10-07 12:42

developer   ~0069317

@c_schmitz, could you please test proposed fix in PR https://github.com/mantisbt/mantisbt/pull/2035 ? Thanks

c_schmitz

c_schmitz

2024-10-08 05:03

reporter   ~0069318

Thank you - works!

Related Changesets

MantisBT: master-2.27 5ff8bb6a

2024-10-07 12:37

dregad


Details Diff
Move fastcgi_finish_request() to email shutdown function

This was originally added to html_end() to improve performance when
using php-fpm and sending mail synchronously [1], back when the function
was calling email_send_all(), i.e. before issue 0017460 moved that to
email_shutdown_function().

This is now causing issues as the HTTP response code is not set when an
error occurs and FastCGI is used.

Fixes 0034828, 0034634

[1]: see commit cea405ccf228fd2c6ac694574a74e87396b14f1f
Affected Issues
0017460, 0034634, 0034828
mod - core/email_api.php Diff File
mod - core/html_api.php Diff File