View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0024393 | mantisbt | db mssql | public | 2018-05-03 04:52 | 2022-05-10 18:44 |
Reporter | rafique.kakati | Assigned To | dregad | ||
Priority | high | Severity | major | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | 2.11.1 | ||||
Target Version | 2.25.4 | Fixed in Version | 2.25.4 | ||
Summary | 0024393: APPLICATION ERROR 401 Database query failed. Error received from database was #-52: SQLState: IMSSP | ||||
Description | When I am trying to Print Reports and Issue Trends of a project whose tickets are greater than 2100, i am getting below error. this is not in the case of csv or excel exports. Please can you help me regarding the same. Attaching the image for the same APPLICATION ERROR 401 Database query failed. Error received from database was #-52: SQLState: IMSSP | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Hi, While searching for the solution of above, found the below link where in they have mentioned that SQL Server Parameters per user-defined function limit is 2,100, below is the link. Can you please help me to modify the query (bug_api.php) so that this issue can be resolved, where in all the data can be printed with this restriction. function bug_get_bugnote_stats_array( array $p_bugs_id, $p_user_id = null ) { $t_query = 'SELECT n.id, n.bug_id, n.reporter_id, n.view_state, n.last_modified, n.date_submitted, b.project_id' } |
|
Hi, Is there any solution for the same? |
|
Indeed I have only come across this (myself) when there are too many items returned by the Query. Since, I don't see anyone complaining about it while using mysql, only when "MSSQL" is running, we are on "hold". Furthermore, since MantisBT doesn't "officially" support or recommend MSSQL we are going to sit and wait for a solution. |
|
We use MS SQL also. This error rarely occurs for me but has happened 3x this year already, so it's becoming more frequent. The only remedy I've found is to create new projects and move all of the issues from the corrupted projects to the new projects. But creating a new project with the categories, versions, users, and custom fields of a previous project is a pain. See 0029746. NOTE: We're running MantisBT 2.25.1, PHP 7.4.13. |
|
I guess this could only be resolved by processing the ids_array by chunks. Something around the line:
Anyone to fill the "..."? |
|
I assume this occurs in the context of a filter returning a large number of rows (Issues). It would be interesting to know more about it, i.e. the steps that led to the error, particularly the stack trace / page being loaded (OP's screenshot shows print_all_bug_page.php, @ggswhitela is this the same for you ?), info about the data set/filter, etc. Note that the purpose of this query is to count the number of bugnotes visible to the user. As a workaround, you could try to remove bugnotes_count from the list of visible columns.
@obmsch You are probably referring to Oracle's limit for expression lists, which can contain no more than 1000 expressions [1]. We are hitting a different limitation here, i.e. the number of parameters in a given query; MSSQL limits that to 2100, but Oracle's restriction is much higher : number of formal parameters in an explicit cursor, function, or procedure is 65536 [2]. |
|
Could you MSSQL guys have a look at the following PR, which implements the fix suggested by @obmsch in 0024393:0066522 Feedback welcome, as I'm not able to actually test this (I don't have access to a MSSQL setup). |
|
@dregad thanks for taking this and offer a solution. I' am quite a bit short of that 2100 Hope the other mssql guys chime in here. |
|
@dregad PR(d7da2c4) looks good. Tested on MantisBT 2.25.3/PHP 8.1/MSSQL 2016/ADOdb 5.22.1 with |
|
This error is random but the steps to reproduce are simple. We use subprojects - I know, it's a deprecated feature - as a view filter. For example, you can have a global developer project with regional subprojects. Then each set of regional users have access to their projects while the developers can uses the header project to see all regional issues. Try this:
Once you get error 401, that header (sub)project is broken forever. My workaround is to create a new header, unlink the subprojects from the old header and re-link it to the new header. The new header then works fine. But if you View Issues on the old header, even with no linked subprojects, you still get error 401 on that header. |
|
@ggswhitela
I really don't understand how you could remedy this by simply creating new (sub)projects and Anyway, as you are on the MantisBT 2.25.x line, applying PR #1805 should get you out there. |
|
@ggswhitela From your description, I get the feeling that your "project corruption" problem is in fact not with the (sub)project itself, but with the filter that is being stored and recalled whenever you try to open the View Issues page again, hitting this bug with the 2100 limit on query parameter over and over. So instead of recreating your project, you may want to try as another, simpler workaround, to try and clear the filter with https:/example.com/mantisbt/view_all_set.php?type=0 |
|
MantisBT: master 810d3384 2022-05-05 10:18 Details Diff |
Process bugnote stats in chunks for MSSQL This is a workaround for SQL Server's limitation of 2100 parameters per query [1], using DbQuery. Fixes 0024393 [1] https://docs.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server |
Affected Issues 0024393 |
|
mod - core/bug_api.php | Diff File | ||
MantisBT: master-2.25 4f4e176d 2022-05-10 08:31 Details Diff |
Process bugnote stats in chunks for MSSQL This is a workaround for SQL Server's limitation of 2100 parameters per query [1], using DbQuery. Fixes 0024393 Cherry picked from merge commit b4214457c30cd8c5c3fe5d053aee0ba88dded0c6 |
Affected Issues 0024393 |
|
mod - core/bug_api.php | Diff File |