Matthias Pigulla wrote:
>
> Hi folks,
>
> I need some advice on tracking down the following problem:
>
> We're using MySQL and PHP to receive binary files (most of them PDF and
> images) submitted by web forms with file upload.
>
> The binary data is stored in a mediumblob field, using a "REPLACE INTO"
> statement. Prior to that, all '"\ are escaped with an additional \ with the
> PHP function addslashes(), which is intended for this purpose. As the
> statement becomes processed by the MySQL server, these backslashes are
> interpreted as escape characters. Finally, the database contains exactly
> what was given to addslashes(). (Allright so far.)
>
> This procedure works fine for almost all binary files. However, there are a
> few files suitable :) to make the MySQL server crash. This can be reproduced
> (on the same machine with the same files).
>
> I found that adding a second call to addslashes() helps, as the server keeps
> running. However, keep in mind that this procedure adds additional
> backslashes for the escaping backslashes from the first call. The PDFs seem
> to be unaffected by that, however, image data gets corrputed. So I removed
> the double addslashes().
>
> Turning on logging of the MySQL server shows the REPLACE INTO statement in
> question as the last entry in the logfile. After that, I found the following
> processes on my machine:
>
> > ps -aux | grep "^mysql"
> mysql 15883 0.1 6.1 18960 7864 p0 S N 12:20 0:00
> /usr/local/libexec/my
> mysql 15885 0.0 0.0 0 0 p0 Z N 12:20 0:00 (mysqld <zombie>)
> mysql 15886 0.0 6.1 18960 7864 p0 S N 12:20 0:00
> /usr/local/libexec/my
>
> The only way to get rid of them and to restart the server is to kill
> -SIGKILL (!).
>
> The binary data varies in size; it works well with files of several MBs,
> this morning's crashs were caused by a ~200KB PDF file. The MySQL server is
> a 3.22.32, running on a Cobalt RaQ2 :-/ with Linux 2.0.34/MIPS.
>
> Any ideas how to go on?
>
> Thanks a lot,
> Matthias
Restart mysqld, re-run the query. If it dies, send us the tables (
ftp://ftp.mysql.com/pub/mysql/secret/ in a tar.gz with a readme, including the
query). We'll take a look at it.
--
Sasha Pachev
+------------------------------------------------------------------+
| /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sasha Pachev |
| /*/ /*/ /*/ \*\_ |*| |*||*| mailto:sasha@stripped |
| /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Provo, Utah, USA |
| /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____ |
| ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ |
| /*/ \*\ Developers Team |
+------------------------------------------------------------------+