[MDEV-4576] I_S temporary table files aren't deleted in Windows - USING ANTIVIRUS Created: 2013-05-24 Updated: 2013-06-17 Due: 2013-07-14 Resolved: 2013-06-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.3, 5.5.31 |
| Fix Version/s: | 5.5.32 |
| Type: | Bug | Priority: | Minor |
| Reporter: | roberto spadim | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
windows 7 32bits pt-br |
||
| Attachments: |
|
| Description |
|
"select * from <information_schema_table_with_problem>" Give errors some times, errcode=13 (no permission?) sql err=6 (problem deleting file) , and files stay in filesystem "forever", only with admin tasks we can remove the file show warnings temporary file isn't deleted <information_schema_table_with_problem> are (in mariadb10.0.2): |
| Comments |
| Comment by Elena Stepanova [ 2013-05-24 ] | ||||||||||||
|
Hi Roberto, Please try to do the same with other tables in information schema – it's about the first problem you reported. Please do not report several unrelated problems in one bug report, only one (at best) will be addressed. Please do not raise JIRA issues for questions that are neither bugs or tasks. There are a mailing list and IRC for that. Thanks. | ||||||||||||
| Comment by roberto spadim [ 2013-05-24 ] | ||||||||||||
|
same problem (/* Erro SQL (6): Error on delete of 'C:\Users\Beto\AppData\Local\Temp#sqlc24_6_1a40.MAD' (Errcode: 13) */) with: i'm running the heidisql in the same machine of windows mariadb 5.5.31, ~10-20 seconds of refresh per table i tested all tables of information_schema: | ||||||||||||
| Comment by roberto spadim [ 2013-05-24 ] | ||||||||||||
|
maybe it happen with remote host too select * from EVENTS ; at database error log have no information about this problem (not changed), and there's no temporary file in tempdir ---------- ------- MariaDB [information_Schema]> select * from TABLE_CONSTRAINTS limit 1;
-------------------
------------------- | ||||||||||||
| Comment by roberto spadim [ 2013-05-24 ] | ||||||||||||
|
tested via internet tcp/ip to linux server running mariadb 10.0.0 and command line tool, and i have no errors (connect drop), maybe a bug in heidisql (very frequent) well i think it's a specific windows temporary file problem, if this help results: linux = no problem with temporary file deletion, windows = problem with temporary files | ||||||||||||
| Comment by Elena Stepanova [ 2013-05-26 ] | ||||||||||||
|
Hi Roberto, I suppose you could easily exclude HeidiSQL from the scenario by replacing it by a script or a tiny program which sends the same queries to the server directly. Meanwhile, let me try to summarize your findings and see if I understand them correctly.
Is this all correct? If so, could you please explain what kind of outcome you would expect instead, given the circumstances? From my point of view, tests like that are totally valid, but they are normally performed to reveal vulnerabilities and points of critical failures which a user can exploit, either intentionally or by mistake. Those are security problems, data corruption, server DoS and, to some extent, client DoS, although the latter is arguable. Getting an error message upon such a scenario seems to be a reasonable result. Do you disagree? Thanks. | ||||||||||||
| Comment by roberto spadim [ 2013-05-26 ] | ||||||||||||
|
hi elena, yes, the stress test only occur with windows 7 32-bit, mariadb-5.5.31 msi binary (in only tested this version), on linux it runs normally | ||||||||||||
| Comment by roberto spadim [ 2013-05-26 ] | ||||||||||||
|
on php with windows some comments at unlink function show that it happen on windows when delete it without fclose file before unlink, on linux there's no problem don't work: works: since it works some times, and sometimes don't, maybe we could retry the unlink on windows if we got a permission error and file still in filesystem? it's a problem since we "lost" connection with database and must retry, ok application can deal with it, but, could we workaround it and make mariadb runs on windows like it runs on linux? | ||||||||||||
| Comment by Elena Stepanova [ 2013-05-26 ] | ||||||||||||
|
Hi Roberto, Your "don't work" and "works" fragments look identical to me. Could you please clarify? >> ok application can deal with it, but, could we workaround it and make mariadb runs on windows like it runs on linux? Possibly, but is it worth the trouble? What is the actual use case that such application tries to implement by bombing the server with I_S queries many times per second, that would be so important that it needs a workaround once it (presumingly) hits an OS-specific limitation and receives an error message? Are you willing to provide a patch for such a workaround? >> but could a "broken" temporary file function implementation have implications with others queries/tables outside of information_schema? Possibly. Did you encounter any such problems outside of information_schema? | ||||||||||||
| Comment by roberto spadim [ 2013-05-26 ] | ||||||||||||
|
the work / don't work is an example in php, fclose before unlink "remove" the permission problem of windows system using temporary files, fclose after unlink (delete) may cause erros like this one in I_S i didn't found a problem outside I_S yet, where i can found from what file and line (or function) the error was generated? there's many deletes in source and i don't know where to find | ||||||||||||
| Comment by roberto spadim [ 2013-06-05 ] | ||||||||||||
|
hi, all tests pointed that only i_s have this problem and only windows version | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-09 ] | ||||||||||||
|
Could you please follow the instructions outlined here https://kb.askmonty.org/en/how-to-use-procmon-to-trace-mysqldexe-filesystem-access/ to trace mysqld.exe file system activity, and send the resulting log ? | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-14 ] | ||||||||||||
|
Roberto ,can you please provide logs, as discussed above? | ||||||||||||
| Comment by roberto spadim [ 2013-06-14 ] | ||||||||||||
|
ok, i will update to mariadb 10.0.3 with debug | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-14 ] | ||||||||||||
|
I'm not sure it will deliver good info . Personally, I would actually prefer the above mentioned https://kb.askmonty.org/en/how-to-use-procmon-to-trace-mysqldexe-filesystem-access/ , however if you think DBUG is is easier for you, we can try that too. | ||||||||||||
| Comment by roberto spadim [ 2013-06-14 ] | ||||||||||||
|
tell me what you need and i try to do my best =] | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-14 ] | ||||||||||||
|
It would be great, If you could follow the section "(Advanced) Seeing stack traces corresponding to events", https://kb.askmonty.org/en/how-to-use-procmon-to-trace-mysqldexe-filesystem-access/ , (add also add directory where mysqld.exe is located to the symbols PATH) After you can reproduce the error with procmon on, save procmon output using "save the file as XML". compress, attach to the report. Thank you! | ||||||||||||
| Comment by roberto spadim [ 2013-06-14 ] | ||||||||||||
|
ok =) with time i will read and execute that, i'm without time now, maybe at weekend i do it, ok? | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-14 ] | ||||||||||||
|
yes, sure, take your time. | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
xml file have 125MB uncompressed! i will attach it | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
xml file of procmon when delete couldn't be done in temporary file | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
i didn't read the mariadb code, but i think that this site is interesting: and this too reading the procmon when file is created: i don't see the temporary file flag, maybe it's the wrong part? | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
reading this: i was thinking that kaspersky antivirus was blocking mariadb, but... | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
i'm uninstalling kaspersky now to redo the test, just some moment to really know if antivirus is or isn't the main problem | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
well antivirus fully removed and after 100000 select * from query_cache_info i got no erros the antivirus was blocking the delete temporary file of mariadb maybe we should add some more comment in error? for example, when running windows instead of: or maybe found a nice solution to run delete with antivirus | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
or maybe in the last file open we put a attribute to delete on close ? i think it's the best solution | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
now reading http://msdn.microsoft.com/en-us/library/aa363915%28v=VS.85%29.aspx If an application attempts to delete a file that does not exist, the DeleteFile function fails with ERROR_FILE_NOT_FOUND. If the file is a read-only file, the function fails with ERROR_ACCESS_DENIED. i think that on close antivirus change file to read_only, and don't allow a delete, just a sugestion... maybe a FILE_FLAG_DELETE_ON_CLOSE on last 'fopen' is the best solution, or maybe after a access_denied we reopen the file with FILE_FLAG_DELETE_ON_CLOSE and close to 'force' a close/delete | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
well for me this | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
attached procmon with antivirus process being included | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
check that in the last file close, the antivirus changed file to read_only and after that mysqld try to delete it again just an idea... i don't know how internally it's done, if table cache can open and close the file and do something that i couldn't explain | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
another information... i was running with skip_external_locking = ON i tried again with skip_external_locking= OFF, and same error (antivirus still blocking delete) | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
antivirus = on again can't delete | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
sorry, i'm an user that didn't read the mysql docs MySQL and Virus Checking Software Using virus scanning software such as Norton/Symantec Anti-Virus on directories containing MySQL data and temporary tables can cause issues, both in terms of the performance of MySQL and the virus-scanning software mis-identifying the contents of the files as containing spam. This is because of the fingerprinting mechanism used by the virus scanning software, and the way in which MySQL rapidly updates different files, which may be identified as a potential security risk. After installing MySQL Server, it is recommended that you disable virus scanning on the main directory (datadir) being used to store your MySQL table data. There is usually a system built into the virus scanning software to permit certain directories to be specifically ignored during virus scanning. In addition, by default, MySQL creates temporary files in the standard Windows temporary directory. To prevent the temporary files also being scanned, you should configure a separate temporary directory for MySQL temporary files and add this to the virus scanning exclusion list. To do this, add a configuration option for the tmpdir parameter to your my.ini configuration file. For more information, see Section 2.3.6.2, “Creating an Option File”. | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-15 ] | ||||||||||||
|
Would you mind checking a mysqld.zip attached? It corresponds to the http://lists.askmonty.org/pipermail/commits/2013-June/004816.html patch . You'd need to unpack mysqld.exe and replace the one that came with installation with the one from zip (the same with mysqld.pdb). What MySQL docs say is fine, but I think we can at least try to improve what we can improve | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
sure, some minutes and i get it | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
well, i don't have visual studio here, do you have the executable file? | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
sorry founded in mdev | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
hummm i got a error about share folder 130615 13:25:50 [Note] | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
could you add the errmsg.sys of your machine? | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
i'm with mariadb 10.0.3 here, maybe the patch is for 5.5.??? | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
i'm with i5 and windows 7 32bits here C:\Program Files\MariaDB 5.5\bin>mysqld-old --version | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
sorry my error again data_dir instead of datadir i will do tests now | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
Same problem using your mysqld.exe file select * from information_schema.QUERY_CACHE_INFO; | ||||||||||||
| Comment by roberto spadim [ 2013-06-15 ] | ||||||||||||
|
proc mon file attached i opened a kaspersky issue to help too while(i<100) or.. instead of a total of 1 second, get a total of (time to write temporary file * 2) or (bigger workaround, but nice solution) | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-15 ] | ||||||||||||
|
Hi, The corresponding patch is http://lists.askmonty.org/pipermail/commits/2013-June/004817.html | ||||||||||||
| Comment by roberto spadim [ 2013-06-16 ] | ||||||||||||
|
sure | ||||||||||||
| Comment by roberto spadim [ 2013-06-16 ] | ||||||||||||
|
downloaded, i will start tests | ||||||||||||
| Comment by roberto spadim [ 2013-06-16 ] | ||||||||||||
|
2640 queries and no error.... | ||||||||||||
| Comment by roberto spadim [ 2013-06-16 ] | ||||||||||||
|
procmon xml file, used 7z compression with ultra, since zip was 50MB and couldn't be uploaded (max of 10MB in jira) | ||||||||||||
| Comment by roberto spadim [ 2013-06-16 ] | ||||||||||||
|
check that 10.0.3 have the same problem | ||||||||||||
| Comment by Vladislav Vaintroub [ 2013-06-17 ] | ||||||||||||
|
fixed in 5.5 (all fixes are merged up to higher version, so it will be in 10.0 too) |