Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal Firebird consistency check ((CMP) copy: cannot remap (221), file: cmp.cpp line: 3085). [CORE5596] #5862

Closed
firebird-automations opened this issue Aug 22, 2017 · 16 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Oleg Matveyev (o_matveev)

Is related to CORE1095

Attachments:
CORE-5596.7z
core-5596.sql
firebird.conf

Prepare query with error:
internal Firebird consistency check ((CMP) copy: cannot remap (221), file: cmp.cpp line: 3085).

___________________________________
SELECT mg.dbBrutto_Full
, COALESCE(
Round((
IIF( exists(select http://g.id from c_goodSpec gs, c_good g where http://gs.id = mg.idGoodspec and http://g.id = gs.idGood and g.idMera0 = 2)
, mg.dbBrutto_Count0 * (mg.dbCount0 - (select count(http://mgi.id) from c_move_good_item mgi where mgi.idMoveGood = http://mg.id /*and mgi.iNumber <> 0*/ and mgi.dbBrutto > 0.001))
, mg.dbBrutto_Count0 * (mg.dbCount0 - COALESCE((select sum(mgi.dbCountList) from c_move_good_item mgi where mgi.idMoveGood = http://mg.id /*and mgi.iNumber <> 0*/ and mgi.dbBrutto > 0.001), 0e0))
)
+ (select (CASE(3)
WHEN g.idMera0 THEN mg.dbCount0
WHEN g.idMera1 THEN mg.dbCount1
WHEN g.idMera2 THEN mg.dbCount2
WHEN g.idMera3 THEN mg.dbCount3
ELSE 0.0
END) from c_goodSpec gs, c_good g
where http://gs.id = mg.idGoodspec
and http://g.id = gs.idGood
) * 28.58
+ COALESCE((select sum(mgi.dbBrutto) from C_Move_Good_Item mgi where mgi.idMoveGood = http://mg.id /*and mgi.iNumber <> 0*/ and mgi.dbBrutto > 0.001), 0e0)
),0)
, 0)

FROM C_Move_Good mg
JOIN C_move m ON m.id=mg.idMove
WHERE m.dtDay >= '01.01.2017' AND m.iRouteType=2
AND mg.ibRekv=0
AND (mg.dbBrutto_Full - COALESCE(
Round((IIF( exists(select http://g.id from c_goodSpec gs, c_good g where http://gs.id = mg.idGoodspec and http://g.id = gs.idGood and g.idMera0 = :idMera_Pack)
, mg.dbBrutto_Count0 * (mg.dbCount0 - (select count(http://mgi.id) from c_move_good_item mgi where mgi.idMoveGood = http://mg.id and mgi.dbBrutto > 0.001))
, mg.dbBrutto_Count0 * (mg.dbCount0 - COALESCE((select sum(mgi.dbCountList) from c_move_good_item mgi where mgi.idMoveGood = http://mg.id and mgi.dbBrutto > 0.001), 0e0))
)
+ (select (CASE(3)
WHEN g.idMera0 THEN mg.dbCount0
WHEN g.idMera1 THEN mg.dbCount1
WHEN g.idMera2 THEN mg.dbCount2
WHEN g.idMera3 THEN mg.dbCount3
ELSE 0.0
END) from c_goodSpec gs, c_good g
where http://gs.id = mg.idGoodspec
and http://g.id = gs.idGood
) * 28.58
+ COALESCE((select sum(mgi.dbBrutto) from C_Move_Good_Item mgi where mgi.idMoveGood = http://mg.id and mgi.dbBrutto > 0.001), 0e0)
),0)
, 0)
)
BETWEEN -0.001 AND 0.001
AND EXISTS( select * from c_goodSpec gs, c_good g
where http://gs.id = mg.idGoodspec
and http://g.id = gs.idGood
and (g.idMera0 = 3 OR g.idMera1 = 3
OR g.idMera2 = 3 OR g.idMera3 = 3));

Commits: FirebirdSQL/fbt-repository@c6560b7

====== Test Details ======

See test for CORE1095 (added there simplified code based on this ticket).

@firebird-automations
Copy link
Collaborator Author

Modified by: Oleg Matveyev (o_matveev)

Attachment: CORE5596.7z [ 13172 ]

Attachment: core-5596.sql [ 13173 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Running which engine version? (Classic, SuperServer)?

What firebird.conf settings? Db page size? Page cache size?

@firebird-automations
Copy link
Collaborator Author

Modified by: Oleg Matveyev (o_matveev)

environment: Dialect 1. Database file in attachment/ => 2.5.6.26967 Firebird Cliassic Server x64, Windows 8.1
Dialect 1. Database file in attachment. page size 16Kb

firebird.conf:
ExternalFileAccess = Restrict D:\Temp
TempDirectories = d:\temp;c:\temp
DefaultDbCachePages = 3584
FileSystemCacheThreshold = 165536
TempCacheLimit = 640000000
LockMemSize = 28672000
LockHashSlots = 10007

@firebird-automations
Copy link
Collaborator Author

Commented by: Oleg Matveyev (o_matveev)

2.5.6.26967 Firebird Cliassic Server x64, Windows 8.1
Dialect 1. Database file in attachment. page size 16Kb

firebird.conf:
ExternalFileAccess = Restrict D:\Temp
TempDirectories = d:\temp;c:\temp
DefaultDbCachePages = 3584
FileSystemCacheThreshold = 165536
TempCacheLimit = 640000000
LockMemSize = 28672000
LockHashSlots = 10007

@firebird-automations
Copy link
Collaborator Author

Modified by: Oleg Matveyev (o_matveev)

Attachment: firebird.conf [ 13174 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Your config settings look odd (too big) for a Classic server config.

How many db connections are active simultaneously?

@firebird-automations
Copy link
Collaborator Author

Commented by: Oleg Matveyev (o_matveev)

This a test server, 3-10 connections

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

What OS is server, how much RAM does it have?

@firebird-automations
Copy link
Collaborator Author

Commented by: Oleg Matveyev (o_matveev)

Again: Windows 8.1, x64 of course
32Gb RAM

Really, all this is important?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

This is a BLR compiler problem, it has nothing to do with the environment.

@firebird-automations
Copy link
Collaborator Author

Commented by: Oleg Matveyev (o_matveev)

Change explicit join to implicit join no any change:

FROM C_Move_Good mg
JOIN C_move m ON m.id=mg.idMove
WHERE m.dtDay >= '01.01.2017' AND m.iRouteType=2
AND mg.ibRekv=0

FROM C_Move_Good mg, C_move m
WHERE m.id=mg.idMove AND m.dtDay >= '01.01.2017' AND m.iRouteType=2
AND mg.ibRekv=0

Bug is reproduced in any case

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is related to CORE1095 [ CORE1095 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

The problem is inside this construct:
(EXPRESSION WITH NESTED SUBQUERY) BETWEEN -0.001 AND 0.001

Fixed in v3.0.2, see also CORE1095. Unlikely to be backported into v2.5.x.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.2 [ 10785 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Covered by another test(s)

Test Details: See test for CORE1095 (added there simplified code based on this ticket).

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant