Bug #1425 | Memory allocation error for BLOB's > 16 MB | ||
---|---|---|---|
Submitted: | 28 Sep 2003 23:57 | Modified: | 4 Oct 2006 13:24 |
Reporter: | Marc Dzaebel | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S1 (Critical) |
Version: | 3.51.06 (any Release?) | OS: | Windows (Windows 2000) |
Assigned to: | Peter Harvey | CPU Architecture: | Any |
[28 Sep 2003 23:57]
Marc Dzaebel
[29 Sep 2003 6:17]
Mark Matthews
Is there a reason you're using the JDBC:ODBC bridge instead of the Type-IV (all Java) Connector/J JDBC driver for MySQL? You'll find (even by Sun's own admission) that the JDBC:ODBC bridge is buggy and not suited for production use. We'll track down why this is happening in MyODBC, though.
[29 Sep 2003 8:42]
Marc Dzaebel
Note, our company mainly develops with CA-VisualObjects rather than Java. To let you have a convenient reproduction sample, I translated the case to Java and got the same error. We want to enable our >1000 customers to work with MySQL as a Web-publishing backend too. In which language would you like to have the reproduction sample? Marc
[6 Oct 2003 3:10]
Venu Anuganti
I could able to reproduce this. Thanks
[9 Oct 2003 2:39]
Marc Dzaebel
Hi Venu, great, that you were able to reproduce the problem! I'd be interested in the code. Is there any schedule for a fix? Thanks, Marc
[29 Jan 2004 18:27]
Boyd Gerber
I could only get this failure at values close to 16 MG values really lager would work.
[29 Jan 2004 18:51]
MySQL Verification Team
I have tested an MyODBC 3.51.07 built from the latest BK tree and compiled against the mysqlclient.lib 4.0.17 without any problems with BLOB files only limited by my machine's RAM size. My tests were: 15, 16, 18, 20, 30, 50, 100, 150 MB Blob sizes.
[24 Feb 2004 22:02]
Peter Harvey
I am able to produce this with a test program I have created using just C and ODBC API. I would love to see Miguel's test codee on this to compare. My thinking at this point is that the problem is really rooted in limitations to the current protocol. The max packet size can be altered (server and client) but what is really needed is an ability to send/receive LONGBLOBs in chunks. see; #1605
[25 Feb 2004 10:02]
Peter Harvey
I have created a test case which shows a problem. Problem may be related to other bug/CSC issues. Perhaps memory allocation but most likley a limitation in protocol for MySQL v4.0. I have attached my test files and requested Miguel re-evaluate.
[25 Feb 2004 10:23]
Peter Harvey
Possibly related is CSC #2230
[25 Feb 2004 19:29]
Peter Harvey
My testing shows the error BUT only under circumstances where the packet size clearly exceeds the max configured into the server. The default, in this case is 1,048,576 bytes. Increasing the max packet size in the server allowed larger packets - and larger BLOB's to go to/from the server. The solution here is for the customer to configure the server to allow packet sizes large enough to handle expected BLOB sizes (and some extra since entire SQL statement must be included). A simple search in the manual for "max_allowed_packet" will give details. In particular; check into the server options file (my.cnf). I recommend closing this Bug. NOTE: Some online doc implies both client and server need to have max_allowed_packet set - either will work but server is only option for doing this with MyODBC (at this time). NOTE: There has been some discussion about chunking data to/from the server. MyODBC does not chunk data *to* the server as it is a feature only available in very recent protocol changes. Chunking data *from* the server is not, currently, supported in any version of the protocol (but there are some tricks to make this happen i.e. using substr). So in a future version of MyODBC (perhaps 3.52) chunking will likely be supported (when used against a supporting server/protocol and/or as a config option). NOTE: Some confusion was created when looking into this bug because building a test in debug mode masked the error. Building the test in Release mode (or outside of VS Project) seems to work fine. This can be an issue for developers. NOTE: This seems to be related to several other bugs. I think those bugs have already been closed. In one case; it appears a custom build was provided as solution. My testing indicates that this *may* not be required as I used latest "stable" releases (assuming MyODBC 3.51 in BK accurately reflects last stable release of MyODBC). NOTE: Testing done with: - MyODBC 3.51 (from BK) on XP - MySQL 4.0.18 ("standard" binary rpm install from web)
[25 Feb 2004 19:57]
Peter Harvey
NOTE: MySQL v3.23.x only supports, up to, 16M max packet size. MySQL v4.0 supports up to 2GB. I gather the custom build (mentioned above) was to have MyODBC 3.51 link against MySQL 4.0 client libraries (this from Mark Matthews). I assume this would allow up to 2GB to be sent/received. Future releases of MyODBC will link with more recent libraries (for example; latest stable libraries when building stable release of MyODBC).
[26 Feb 2004 4:37]
MySQL Verification Team
We can not expect that our users will set all parameters correctly. There should be no error and no memory allocation error even if max_allowed_packet is set to 2 bytes. Workarounds are not good enough. This bug has to be fixed so that no allocation errors and no crash occurs regardless of the settings on the client or server.
[26 Feb 2004 9:29]
Peter Harvey
I experienced no "allocation errors and no crash" during my testing.
[12 May 2004 20:07]
Craig Hunt
Peter: Do you have any status on this issue? I've recently encountered a similar scenario which consistently produces the same error. ERROR [HY001] [MySQL][ODBC 3.51 Driver][mysqld-4.0.18-log]Memory allocation error Using the MyODBC 3.51 driver, I currently have an ASP.NET client written in VB.NET to talk to a mysql 4.0.18 database running on Debian. The application provides an web based interface for file uploads which the system stores in the mysql database. I do not encounter errors until I attempt to upload files larger than 14,674,944 bytes - at least that's the largest file I successfully uploaded. The limit may be slightly higher, but it's lower than 16,397,730 bytes. The field in which I store the files bears a longblob dbtype. The application's web server runs IIS 5 on Windows 2000, SP4 and .NET Framework v1.1. The database server runs Debian test release MySQL v4.0.18. Pertinent my.cnf settings: #skip-networking key_buffer = 100M max_allowed_packet = 100M thread_stack = 128K # # Query Cache Configuration # query_cache_limit = 1048576 query_cache_size = 26214400 query_cache_type = 1 [isamchk] key_buffer = 100M -- End Settings -- Please let me know if I can supply any additional information. Thanks for any reply. Regards, Craig Hunt
[20 Apr 2006 15:55]
Mark Matthews
At least one "direction" of this will be fixed in Connector/ODBC 5.0 when it uses server-side prepared statements, since "long" data can be sent in chunks to the server. Unfortunately, it's a limitation of the _server_ that long data must be sent entirely at once to the client for _reads_, and so until that changes, there will still be cases where the driver will not be able to allocate enough memory to _read_ large BLOBs.