Subject RE: [Firebird-Java] JVM crashes from exception in JDBC driver
Author Ryan Baldwin
Hi Kenneth,

>But since arraycopy is called by FBBlob$FBBlobOutputStream.write ...
>it could also be non-JVM errors

I was going to post again to clarify what I said a bit but decided against
it as it was a bit rambling - I was going to post -

>Really we should not be able to crash the virtual machine from just java
>code which is why I suspect a JVM problem or hardware problem rather then a
>problem with jaybird itself.

Just to clarify myself - It is possible that their 'is' a bug in the jaybird
code and we are passing bad values into System.arraycopy - but if this where
the case then an exception should be thrown - so if we are - or are not
passing bad parameters to this method then the crash is probarbly a JVM
problem. If we are passing bad parameters to this method for some reason
then the crash is hiding the usefull infomation that an exception would
contain. If this is the case the trying the client VM or perhaps disabling
compilation altogether may show up an exception if their is a jaybird bug -
allowing this to be investigated seperatly.

I hope this makes some sense.


>Maybe I should use ps.setBytes() instead?

What you are doing shouldent lead to the problem you are having - the
setBytes method would do this

if (value == BYTES_NULL_VALUE) {
setNull();
return;
}

byte[] data = field.encodeString(value, javaEncoding);
setBinaryStream(new ByteArrayInputStream(data), data.length);

So other then encoding the bytes acording to the javaEncoding for the field
it would end up doing the same thing. I cant really say what would be best -
but the method you are using should work.

It will be intersting to see if the problem reproduces with the client VM.

Thanks
Ryan





-----Original Message-----
From: Kenneth Foo [mailto:kenneth@...]
Sent: 02 October 2003 14:02
To: Firebird-Java@yahoogroups.com
Subject: Re: [Firebird-Java] JVM crashes from exception in JDBC driver


Hi Ryan

The crash happens fairly frequent...about once a day or once
every 2 days, and it always happens at the same place.
(Attached are the logs files for 2 crashes)

Having the exception from java.lang.System.arraycopy
indicates that this is a JVM error.

But since arraycopy is called by FBBlob$FBBlobOutputStream.write ...
it could also be non-JVM errors.

I'm trying out with client JVM to see if anything happens within the
next couple of days.


Btw, my code that inconsistently causes the problem is

private static final void setBlob(PreparedStatement ps, int columnindex,
Object v) throws java.sql.SQLException {
// Now set the actual binary column data by passing the
if (v==null)
ps.setNull(columnindex, java.sql.Types.BLOB);
else {
byte[] buf = null;
if (v instanceof byte[]) {
buf = (byte[])v;
}
else {
try {
buf = v.toString().getBytes("UTF8");
}
catch (java.io.UnsupportedEncodingException ex) {
throw new SQLException(ex.toString());
}
}
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
ps.setBinaryStream(columnindex, bais, buf.length);
}
}



Maybe I should use ps.setBytes() instead?

----- Original Message -----
From: "Ryan Baldwin" <ryan.baldwin@...>
To: <Firebird-Java@yahoogroups.com>
Sent: Thursday, October 02, 2003 7:31 PM
Subject: RE: [Firebird-Java] JVM crashes from exception in JDBC driver


> Hi,
>
> I've havent come across this problem myself. I looks quite interesting.
How
> often does this happen ? Do you still have the hs_err_pid*.log files for
the
> crashes that have happened. If so it might be worth looking back through
> these.
>
> If the crash is consistant in terms of where and how it occurs I would
tend
> to suspect a JVM bug. If the crashses are more random then I might begin
to
> suspect the hardware.
>
> Your using the Hotspot Server VM - it would be intersting to see if you
can
> re-produce this bug with the hotspot client VM - as if it is not possible
it
> may indicate a bug in the Hotspot Server VM's compiler or somthing along
> those lines.
>
> Really we should not be able to crash the virtual machine from just java
> code which is why I suspect a JVM problem or hardware problem rather then
a
> problem with jaybird itself.
>
> I hope this is of some help.
>
> Ryan
>
>
>
> -----Original Message-----
> From: Kenneth Foo [mailto:kenneth@...]
> Sent: 02 October 2003 10:19
> To: firebird-java@yahoogroups.com
> Subject: [Firebird-Java] JVM crashes from exception in JDBC driver
>
>
> Hi All
>
> I'm getting this problem quite often in a production system.
> The JVM crashes with and error and it's usually fro mthis
> FBBlob$FBBlobOutputStream class...
> Any solutions? I think I'm running a fairly recent (about 1 or 2 weeks
old)
> CVS version of the driver.
>
> Regards
> Kenneth
>
> Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D565C4E
> Function=JVM_ArrayCopy+0x8E
> Library=c:\j2sdk1.4.1\jre\bin\server\jvm.dll
>
> Current Java thread:
> at java.lang.System.arraycopy(Native Method)
> at
> org.firebirdsql.jdbc.FBBlob$FBBlobOutputStream.write(FBBlob.java:747)
> at org.firebirdsql.jdbc.FBBlob.copyStream(FBBlob.java:459)
> at
>
org.firebirdsql.jdbc.FBLongVarCharField.copyBinaryStream(FBLongVarCharField.
> java:199)
> at
>
org.firebirdsql.jdbc.FBLongVarCharField.setBinaryStream(FBLongVarCharField.j
> ava:211)
> at
>
org.firebirdsql.jdbc.FBPreparedStatement.setBinaryStream(FBPreparedStatement
> .java:156)
> at com.nic.connect.db.MessageDB.setBlob(MessageDB.java:293)
> at
> com.nic.connect.db.MessageDB.prepareUpdateStatement(MessageDB.java:368)
> at
> com.nic.connect.db.MessageDB.internalUpdateMessage(MessageDB.java:2175)
> at com.nic.connect.db.MessageDB.createMessage(MessageDB.java:2051)
> at
> com.nic.connect.cc.OperationsHandler.execute(OperationsHandler.java:596)
> at com.nic.cc.CommandManager.execute(CommandManager.java:43)
> at
> com.nic.connect.cc.OperationsHandler.execute(OperationsHandler.java:541)
> at com.nic.cc.CommandManager.execute(CommandManager.java:43)
> at com.nic.connect.ContextImpl.sendMessage(ContextImpl.java:747)
> at
> org.apache.jsp.do_composemsg_jsp._jspService(do_composemsg_jsp.java:261)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
> 10)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:247)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:193)
> at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:256)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:191)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
> 46)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
> at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
> )
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
> java:171)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
> )
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :174)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
> at
>
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
> ction(Http11Protocol.java:392)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
> at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> a:619)
> at java.lang.Thread.run(Thread.java:536)
>
> Dynamic libraries:
> 0x00400000 - 0x00406000 c:\j2sdk1.4.1\bin\java.exe
> 0x77F80000 - 0x77FFA000 C:\WINNT\system32\ntdll.dll
> 0x77DB0000 - 0x77E0B000 C:\WINNT\system32\ADVAPI32.dll
> 0x77E80000 - 0x77F31000 C:\WINNT\system32\KERNEL32.dll
> 0x77D30000 - 0x77D9E000 C:\WINNT\system32\RPCRT4.dll
> 0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
> 0x6D470000 - 0x6D6E1000 c:\j2sdk1.4.1\jre\bin\server\jvm.dll
> 0x77E10000 - 0x77E6F000 C:\WINNT\system32\USER32.dll
> 0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll
> 0x77570000 - 0x775A0000 C:\WINNT\System32\WINMM.dll
> 0x6D1E0000 - 0x6D1E7000 c:\j2sdk1.4.1\jre\bin\hpi.dll
> 0x6D310000 - 0x6D31E000 c:\j2sdk1.4.1\jre\bin\verify.dll
> 0x6D220000 - 0x6D239000 c:\j2sdk1.4.1\jre\bin\java.dll
> 0x6D330000 - 0x6D33D000 c:\j2sdk1.4.1\jre\bin\zip.dll
> 0x6D2E0000 - 0x6D2EE000 C:\j2sdk1.4.1\jre\bin\net.dll
> 0x75050000 - 0x75058000 C:\WINNT\System32\WSOCK32.dll
> 0x75030000 - 0x75043000 C:\WINNT\System32\WS2_32.DLL
> 0x75020000 - 0x75028000 C:\WINNT\System32\WS2HELP.DLL
> 0x74FD0000 - 0x74FED000 C:\WINNT\system32\msafd.dll
> 0x75010000 - 0x75017000 C:\WINNT\System32\wshtcpip.dll
> 0x782C0000 - 0x782CC000 C:\WINNT\System32\rnr20.dll
> 0x77980000 - 0x779A4000 C:\WINNT\System32\DNSAPI.DLL
> 0x77340000 - 0x77353000 C:\WINNT\System32\iphlpapi.dll
> 0x77520000 - 0x77525000 C:\WINNT\System32\ICMP.DLL
> 0x77320000 - 0x77337000 C:\WINNT\System32\MPRAPI.DLL
> 0x75150000 - 0x75160000 C:\WINNT\System32\SAMLIB.DLL
> 0x75170000 - 0x751BF000 C:\WINNT\System32\NETAPI32.DLL
> 0x77BE0000 - 0x77BEF000 C:\WINNT\System32\Secur32.dll
> 0x751C0000 - 0x751C6000 C:\WINNT\System32\NETRAP.dll
> 0x77950000 - 0x77978000 C:\WINNT\system32\WLDAP32.dll
> 0x77A50000 - 0x77B3C000 C:\WINNT\system32\OLE32.DLL
> 0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.DLL
> 0x773B0000 - 0x773DE000 C:\WINNT\System32\ACTIVEDS.DLL
> 0x77380000 - 0x773A2000 C:\WINNT\System32\ADSLDPC.DLL
> 0x77830000 - 0x7783E000 C:\WINNT\System32\RTUTILS.DLL
> 0x77880000 - 0x7790D000 C:\WINNT\System32\SETUPAPI.DLL
> 0x77C10000 - 0x77C6D000 C:\WINNT\System32\USERENV.DLL
> 0x774E0000 - 0x77512000 C:\WINNT\System32\RASAPI32.DLL
> 0x774C0000 - 0x774D1000 C:\WINNT\System32\RASMAN.DLL
> 0x77530000 - 0x77552000 C:\WINNT\System32\TAPI32.DLL
> 0x77B50000 - 0x77BD9000 C:\WINNT\system32\COMCTL32.DLL
> 0x77C70000 - 0x77CBA000 C:\WINNT\system32\SHLWAPI.DLL
> 0x77360000 - 0x77379000 C:\WINNT\System32\DHCPCSVC.DLL
> 0x777E0000 - 0x777E8000 C:\WINNT\System32\winrnr.dll
> 0x777F0000 - 0x777F5000 C:\WINNT\System32\rasadhlp.dll
> 0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
> 0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
> 0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL
>
> Local Time = Thu Oct 02 17:00:58 2003
> Elapsed Time = 95934
> #
> # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
> # Error ID : 4F530E43505002E6
> # Please report this error at
> # http://java.sun.com/cgi-bin/bugreport.cgi
> #
> # Java VM: Java HotSpot(TM) Server VM (1.4.1_05-b01 mixed mode)
> #
> # An error report file has been saved as hs_err_pid2688.log.
> # Please refer to the file for further information.
> #
>
> E:\NCS>
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/