Bug #59941 cluster/j - columns with varbinary(>255) fails
Submitted: 4 Feb 2011 10:50 Modified: 31 Mar 2011 11:10
Reporter: Johan Andersson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster/J Severity:S3 (Non-critical)
Version:7.1.9a OS:Any
Assigned to: Craig Russell CPU Architecture:Any
Tags: cluster, ClusterJ

[4 Feb 2011 10:50] Johan Andersson
Description:
When having a column with VARBINARY(256) (or larger) the following happens:

XXX xxx=s.newInstance(XXX.class);
[2/4/11 11:06:37 AM] Johan Andersson: Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 5
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 8
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 15
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 31
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 47
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 48
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 49
Feb 4, 2011 11:05:01 AM com.mysql.clusterj.tie.Utility addCollation
INFO: Adding charset converter latin1 for collation 94
Invalid memory access of location 0x0 rip=0x11a01184b

How to repeat:
create table t1(a integer primary key, b varbinary(256))engine=ndb;

...
myT1 m1=s.newInstance(myT1.class);

gives the above

myT1.java

import com.mysql.clusterj.annotation.PersistenceCapable;
import com.mysql.clusterj.annotation.PrimaryKey;

@PersistenceCapable(table="t1")
public interface myT1 {
		@PrimaryKey
		int getA();
		void setA(int id);

		byte [] getB();
		void setB(byte [] data);

}

Main.java

import java.util.Properties;
import com.mysql.clusterj.*;
public class Main {

	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	                 try
			{
				Properties p = new Properties();
				p.setProperty("com.mysql.clusterj.connectstring", "localhost:1186");
				p.setProperty("com.mysql.clusterj.database", "test");
				SessionFactory sessionFactory=ClusterJHelper.getSessionFactory(p);
				Session s = sessionFactory.getSession();
				System.err.println("here");

				myT1 m1=s.newInstance(myT1.class);
                        }
			catch(Exception e)
			{
				e.printStackTrace();
			}
		
	}

}
[4 Feb 2011 22:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/130484

4083 Craig L Russell	2011-02-04
      Bug #59941 VM crash invalid memory access with varbinary(256) column
      clusterj was incorrectly asking for the charset for a longvarbinary column.
[4 Feb 2011 23:54] Craig Russell
The important part of the patch is the file 
storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ColumnImpl.java

The others are test files.
[31 Mar 2011 11:10] Jon Stephens
Documented fix in the NDB-7.1.12 changelog as follows:

      ClusterJ incorrectly asked for the character set for a LONGVARBINARY
      column with VARBINARY(256) columns, leading to a VM crash caused by
      invalid memory access.

Closed.