Hi Shawn,

Many thanks for the note & the suggestion!  I am using MySQL as my Db and 
MM.MySQL is my driver (mm.mysql-2.0.11-bin.jar).  Given that this is a Type 
4 driver, I don't think I should be getting a native code crash involving 
database access, right?

I could be missing something, but it seems that the 
sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream() method (which is 
native code) is trying to write to my output stream and running into 
trouble.  I assume this is because the user has clicked on an image serving 
as a link to another web page and now Tomcat is off trying to handle the 
new page.  My best guess is that in the process of doing so, the output 
streams used by writeJPEGStream() are being torn down, but the native code 
doesn't know this and it's causing the VM to puke.  Does anyone think my 
logic makes sense?  Better yet, does anyone know a way to prevent it? :-)

Regards, Kennedy

At 09:02 AM 2/23/2002 -0600, Shawn Church wrote:
>Looks like you are using the JDBC-ODBC bridge (maybe to an MS Access or MS
>SQL Server database?), which is not thread-safe and is not intended for use
>in production environments.  My guess is that one thread (the current thread
>servicing the Thumbnail servlet) has a db connection open, and the next
>request (the user clicking the thumbnail) opens another db connection.  This
>guess is based on these lines in your exception:
>
>An unexpected exception has been detected in native code outside the VM.
>Unexpected Signal : unknown exception code occurred at PC=0x77fb16cc
>Function name=RtlTraceDatabaseEnumerate
>Library=C:\WINNT\System32\ntdll.dll
>
>If this is the case, try finding a pure Java (type 4) JDBC driver for your
>database.
>
>Shawn
>
>
>-----Original Message-----
>From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, February 23, 2002 5:36 AM
>To: [EMAIL PROTECTED]
>Subject: Help Preventing VM & Tomcat Crash
>
>
>I'm working on a servlet that shrinks JPEG photos on the fly to create
>thumbnails.  When the user selects the thumbnail page, a JSP generates HTML
>that results in many calls to the thumbnail servlet.  If the user is
>patient and waits for all of the thumbnails to load, everything works great
>-- they can click on a thumbnail to see the full-size version of that
>JPEG.  However, if the use clicks on a photo while they are still loading,
>I get the exception dump and crash shown at the bottom.  Any help greatly
>appreciated!  Regards, Kennedy
>
>Here is my thumbnail servlet:
>/*
>   * Note: JPEG manipulation code comes from Sun:
>   * http://developer.java.sun.com/developer/TechTips/1999/tt1021.html#tip1
>   */
>package gallery.servlet;
>
>import java.io.*;
>import java.text.*;
>import java.util.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.awt.Image;
>import java.awt.Graphics2D;
>import java.awt.geom.AffineTransform;
>import java.awt.image.BufferedImage;
>import javax.swing.ImageIcon;
>import com.sun.image.codec.jpeg.JPEGCodec;
>import com.sun.image.codec.jpeg.JPEGImageEncoder;
>
>
>/**
>   * Return a thumbnail of the image specified in the name parameter
>   */
>
>public class Thumbnail extends HttpServlet {
>
>
>      public void doGet(HttpServletRequest request,
>                        HttpServletResponse response)
>          throws IOException, ServletException
>      {
>          response.setContentType("image/jpeg");
>          File f = new File(request.getParameter("name"));
>          if (!f.exists())
>              return;
>          OutputStream os = response.getOutputStream();
>          createThumbnail(request.getParameter("name"), os, 150);
>      }
>
>      /**
>       * Reads an image in a file and creates a thumbnail to the output
>stream
>       *
>       * @param orig  The name of image file.
>       * @param thumb The name of thumbnail file.
>       *                 Will be created if necessary.
>       * @param maxDim The width and height of the thumbnail must
>       *                 be maxDim pixels or less.
>       */
>      public static void createThumbnail(String orig, OutputStream os, int
>maxDim) {
>          try {
>              // Get the image from a file.
>              Image inImage = new ImageIcon(orig).getImage();
>
>              // Determine the scale.
>              double scale = (double)maxDim/(double)inImage.getHeight(null);
>              if (inImage.getWidth(null) > inImage.getHeight(null)) {
>                  scale = (double)maxDim/(double)inImage.getWidth(null);
>              }
>
>              // Determine size of new image.
>              // One of them should equal maxDim.
>              int scaledW = (int)(scale*inImage.getWidth(null));
>              int scaledH = (int)(scale*inImage.getHeight(null));
>
>              // Create an image buffer in which to paint on.
>              BufferedImage outImage =
>                new BufferedImage(scaledW, scaledH,
>BufferedImage.TYPE_INT_RGB);
>
>              // Set the scale.
>              AffineTransform tx = new AffineTransform();
>
>              // If the image is smaller than
>              //the desired image size,
>              // don't bother scaling.
>              if (scale < 1.0d) {
>                  tx.scale(scale, scale);
>              }
>
>              // Paint image.
>              Graphics2D g2d = outImage.createGraphics();
>              g2d.drawImage(inImage, tx, null);
>              g2d.dispose();
>
>              // JPEG-encode the image and write to file.
>              //OutputStream os = new FileOutputStream(thumb);
>              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
>              encoder.encode(outImage);
>              //os.close();
>          } catch (IOException e) {
>              e.printStackTrace();
>          }
>      }
>}
>
>
>
>And here is the exception/crash:
>java.io.IOException: reading encoded JPEG Stream
>          at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native
>Method)
>          at
>sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:47
>5)
>
>          at
>sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:23
>1)
>          at gallery.servlet.Thumbnail.createThumbnail(Thumbnail.java:85)
>          at gallery.servlet.Thumbnail.doGet(Thumbnail.java:35)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>          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:243)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
>va:201)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
>.java:518)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
>          at
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
>)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
>java:170)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
>)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
>:163)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
>1011)
>          at
>org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106
>)
>          at java.lang.Thread.run(Thread.java:484)
>An unexpected exception has been detected in native code outside the VM.
>Unexpected Signal : unknown exception code occurred at PC=0x77fb16cc
>Function name=RtlTraceDatabaseEnumerate
>Library=C:\WINNT\System32\ntdll.dll
>
>Current Java thread:
>          at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native
>Method)
>          at
>sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:47
>5)
>          at
>sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:23
>1)
>          at gallery.servlet.Thumbnail.createThumbnail(Thumbnail.java:85)
>          at gallery.servlet.Thumbnail.doGet(Thumbnail.java:35)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>          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:243)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
>va:201)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
>.java:518)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
>          at
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
>)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
>java:170)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
>)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>64)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
>:163)
>          at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
>66)
>          at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>          at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>          at
>org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
>1011)
>          at
>org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106
>)
>          at java.lang.Thread.run(Thread.java:484)
>
>Dynamic libraries:
>0x00400000 - 0x00405000         D:\JBuilder6\jdk1.3.1\bin\java.exe
>0x77F80000 - 0x77FFB000         C:\WINNT\System32\ntdll.dll
>0x77DB0000 - 0x77E0B000         C:\WINNT\system32\ADVAPI32.dll
>0x77E80000 - 0x77F35000         C:\WINNT\system32\KERNEL32.DLL
>0x77D40000 - 0x77DAC000         C:\WINNT\system32\RPCRT4.DLL
>0x78000000 - 0x78046000         C:\WINNT\system32\MSVCRT.dll
>0x6D420000 - 0x6D4EE000
>D:\JBuilder6\jdk1.3.1\jre\bin\hotspot\jvm.dll
>0x77E10000 - 0x77E74000         C:\WINNT\system32\USER32.dll
>0x77F40000 - 0x77F7C000         C:\WINNT\system32\GDI32.DLL
>0x77570000 - 0x775A0000         C:\WINNT\System32\WINMM.dll
>0x681A0000 - 0x681A7000         C:\WINNT\System32\serwvdrv.dll
>0x66740000 - 0x66747000         C:\WINNT\System32\umdmxfrm.dll
>0x6D220000 - 0x6D227000         D:\JBuilder6\jdk1.3.1\jre\bin\hpi.dll
>0x6D3B0000 - 0x6D3BD000         D:\JBuilder6\jdk1.3.1\jre\bin\verify.dll
>0x6D250000 - 0x6D266000         D:\JBuilder6\jdk1.3.1\jre\bin\java.dll
>0x6D3C0000 - 0x6D3CD000         D:\JBuilder6\jdk1.3.1\jre\bin\zip.dll
>0x6D340000 - 0x6D348000         D:\JBuilder6\jdk1.3.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 - 0x74FEF000         C:\WINNT\system32\msafd.dll
>0x75010000 - 0x75017000         C:\WINNT\System32\wshtcpip.dll
>0x785C0000 - 0x785CC000         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 - 0x77979000         C:\WINNT\system32\WLDAP32.DLL
>0x77A50000 - 0x77B3A000         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
>0x716F0000 - 0x7177A000         C:\WINNT\system32\COMCTL32.DLL
>0x70BD0000 - 0x70C1C000         C:\WINNT\system32\SHLWAPI.DLL
>0x77360000 - 0x77379000         C:\WINNT\System32\DHCPCSVC.DLL
>0x775A0000 - 0x77625000         C:\WINNT\System32\CLBCATQ.DLL
>0x777E0000 - 0x777E8000         C:\WINNT\System32\winrnr.dll
>0x777F0000 - 0x777F5000         C:\WINNT\System32\rasadhlp.dll
>0x6D020000 - 0x6D128000         D:\JBuilder6\jdk1.3.1\jre\bin\awt.dll
>0x77800000 - 0x7781D000         C:\WINNT\System32\WINSPOOL.DRV
>0x75E60000 - 0x75E7A000         C:\WINNT\System32\IMM32.dll
>0x6D1E0000 - 0x6D21B000
>D:\JBuilder6\jdk1.3.1\jre\bin\fontmanager.dll
>0x51000000 - 0x51044000         C:\WINNT\System32\DDRAW.dll
>0x728A0000 - 0x728A6000         C:\WINNT\System32\DCIMAN32.dll
>0x69000000 - 0x6910E000         C:\WINNT\System32\ATIO2KAB.dll
>0x6D2C0000 - 0x6D2DB000         D:\JBuilder6\jdk1.3.1\jre\bin\jpeg.dll
>0x77920000 - 0x77943000         C:\WINNT\system32\imagehlp.dll
>0x72A00000 - 0x72A2D000         C:\WINNT\system32\DBGHELP.dll
>0x0C680000 - 0x0C68B000         C:\WINNT\System32\PSAPI.DLL
>
>Local Time = Fri Feb 22 22:39:59 2002
>Elapsed Time = 82
>#
># The exception above was detected in native code outside the VM
>#
># Java VM: Java HotSpot(TM) Client VM (1.3.1_01 mixed mode)
>#
># An error report file has been saved as hs_err_pid456.log.
># Please refer to the file for further information.
>#
>E:\java\tomcat4\bin>
>
>
>--
>To unsubscribe:   <mailto:[EMAIL PROTECTED]>
>For additional commands: <mailto:[EMAIL PROTECTED]>
>Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe:   <mailto:[EMAIL PROTECTED]>
>For additional commands: <mailto:[EMAIL PROTECTED]>
>Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to