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

Random crash 64bit fb_inet_server. Possible collation issue [CORE6054] #6304

Closed
firebird-automations opened this issue Apr 26, 2019 · 20 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: ERCAN P. (programlama_akinsoft.com.tr)

Attachments:
DbgX.Shell_2019-04-26_16-41-47.png

Hello. We are facing crash issue for about 10 days. Server has about 20 DB and is under load in working hours. Event Viewer shows unexpected terminations of server process. I have windbg dump file and it has sensitive information.

Commits: 8df4b76

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

I am trying to attach screenshot.

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

WinDgb output sceentshot added.. I can send zipped dump file to a developer.

@firebird-automations
Copy link
Collaborator Author

Modified by: ERCAN P. (programlama_akinsoft.com.tr)

Attachment: DbgX.Shell_2019-04-26_16-41-47.png [ 13341 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Provide us with download link, please

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

You can download from this link.

http://daprox.com/paylasim/download.php?id=C9A39C-031502

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Send pwd to mailto:hvlad@users.sourceforge.net, please

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Thanks,
seems i found the reason.

Is it reproducible ? I want to verify patch.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Call stack of crashing thread

#⁠ Call Site
00 fb_inet_server!lookup_symbol+0xb [e:\fb25_git\r2_5_8\gen\x64\dsql\metd.cpp @ 3181]
01 fb_inet_server!METD_get_collation+0xec [e:\fb25_git\r2_5_8\gen\x64\dsql\metd.cpp @ 635]
02 fb_inet_server!pass1_constant+0x1d0 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 3969]
03 fb_inet_server!PASS1_node+0xacc [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 817]
04 fb_inet_server!PASS1_node+0xd6 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 580]
05 fb_inet_server!PASS1_node+0x176b [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 1117]
06 fb_inet_server!PASS1_node+0x176b [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 1117]
07 fb_inet_server!pass1_node_psql+0x36 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 7403]
08 fb_inet_server!pass1_rse_impl+0x576 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 8155]
09 fb_inet_server!pass1_rse+0x67 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 8031]
0a fb_inet_server!pass1_rse_impl+0xd1 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 8081]
0b fb_inet_server!pass1_rse+0x67 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 8031]
0c fb_inet_server!PASS1_rse+0x28 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 1237]
0d fb_inet_server!PASS1_statement+0x13a8 [e:\fb25_git\r2_5_8\src\dsql\pass1.cpp @ 1871]
0e fb_inet_server!prepare+0x80b [e:\fb25_git\r2_5_8\src\dsql\dsql.cpp @ 2644]
0f fb_inet_server!DSQL_prepare+0x2d8 [e:\fb25_git\r2_5_8\src\dsql\dsql.cpp @ 732]
10 fb_inet_server!jrd8_prepare+0x397 [e:\fb25_git\r2_5_8\src\jrd\jrd.cpp @ 4258]
11 fb_inet_server!isc_dsql_prepare_m+0x2f8 [e:\fb25_git\r2_5_8\src\jrd\why.cpp @ 3644]
12 fb_inet_server!rem_port::prepare_statement+0x3c9 [e:\fb25_git\r2_5_8\src\remote\server.cpp @ 3253]
13 fb_inet_server!process_packet+0x53f [e:\fb25_git\r2_5_8\src\remote\server.cpp @ 3556]
14 fb_inet_server!loopThread+0x1a1 [e:\fb25_git\r2_5_8\src\remote\server.cpp @ 5269]

Looks like global_temp_collation_name (see frame 02) contains garbage left from previous failed attempt to parse some query.

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

Hello, We solved crash temporarily yesterday by removing php service directory. Same service implemented as http://asp.net mvc (the time crash begin). We checked network logs and saw some search engines access the old php directory. We removed the complete directory for try and problem gone. We investigated running sql and there was an sql query which try to select recently removed column. It is reproducible (by activating php page)

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

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

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

Hello Mr. Sean. Why did you flag this report as "Wont Fix" ? We (three senior developers) spent nearly 2 weeks to solve this problem. If Mr. Vlad send us a patch we will be happy to try and send the result.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Ercan,

Sorry, you posted that the problem was caused by external function (php service directory), as such there was no Firebird change required.

Separately, there was no mention that Vlad had provided a patch.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

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

assignee: Vlad Khorsun [ hvlad ]

resolution: Won't Fix [ 2 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

Thank you Mr Sean. Yes we solved problem temporarily. But it is not a real solution. Other developers may suffer from same problem in the future.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

The minimal reproducible sample:

1. prepare table

SQL> create table c (id int, f1 varchar(32) character set win1251 collate win1251);

2. run bad query with COLLATE clause

SQL> select * from c where f2 collate win1251_ua = 'x';
Statement failed, SQLSTATE = 42S22
Dynamic SQL Error
-SQL error code = -206
-Column unknown
-F2
-At line 1, column 26

3. run query with string constant and charset introducer

SQL> select * from c where f1 = _utf8 'x';
Statement failed, SQLSTATE = HY004
Dynamic SQL Error
-SQL error code = -204
-Data type unknown
-COLLATION for CHARACTER SET UTF8 is not defined

Here we see wrong error message with empty collation name.
In more complex cases there could be crash.
Expected - no error message.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fix is committed, please try next snapshot build

@firebird-automations
Copy link
Collaborator Author

Commented by: ERCAN P. (programlama_akinsoft.com.tr)

Thank you Mr. Vlad. I think php service produced "column unknown" error and new http://asp.net service run query with _utf8 keyword (query built by .net provider). Same time we got a lot of "COLLATION for CHARACTER SET UTF8 is not defined" error feedback from our users before closing php service.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Reopened [ 4 ] => Reopened [ 4 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.9 [ 10862 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

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

2 participants