Any tips for building Tomcat Native on Windows 10?

Best regards,
Eduardo Quintanilla
Software Developer
Block Networks<http://www.blocknetworks.com.mx/>

From: Christopher Schultz <ch...@christopherschultz.net>
Sent: jueves, 22 de agosto de 2019 11:57 a. m.
To: users@tomcat.apache.org
Subject: Re: Tomcat 8.5 - Native Library - Crash


Eduardo,

On 8/22/19 10:18, Eduardo Quintanilla wrote:
> Chris,
>
> The crash dump and logs[1] from my dev environment.
>
> [1]https://1drv.ms/u/s!AjSSUmqOgKmfi1g7z4wUvfYPksCk?e=CLH6VF

Okay, as I suspected, it's a SIGSEGV, or what Java programmers would
call a NullPointerException.

The C code is computing a pointer with a 44 byte offset to a NULL
pointer and trying to dereference it, which causes the problem.

I'm not sure which field has a 44-byte offset into the structure it's
supposed to be contained in. That highly depends upon the
architecture, compiler, etc. and those are the things I don't have
access to.

If someone in the community is able to build tcnative for Windows in
the same way[1] that the Tomcat team builds it, can you identify the
following:

1. What line of code corresponds to tcnative-1.dll+0x14d32
2. Which structure is being used
3. Which field is 44 bytes into that structure

Knowing all those things should make this a very easy fix.

Of course, the "fix" will involve throwing an exception back over into
the Java space, to the application will still throw an error. But at
least it won't bring-down the whole JVM.

>> Do you always get the "stream is not writable" error before the
>> JVM performs the crash-dump?
>
> Yes but only in the Tomcat of the production environment.

That's ... interesting. If Tomcat knows it can't write to the
stream... why is it still writing to the stream?

Note that the crash dump you posted is for an error in
jni.Address.get() and not the one for Socket.sendb(). If you can
generate a crash dump in Socket.sendb() that would be helpful, too.

Also, please see:

https://bz.apache.org/bugzilla/show_bug.cgi?id=62626
https://bz.apache.org/bugzilla/show_bug.cgi?id=63405

-chris

>
> Best regards, Eduardo Quintanilla Software Developer
>
> From: Christopher Schultz 
> <ch...@christopherschultz.net<mailto:ch...@christopherschultz.net>> Sent:
> jueves, 22 de agosto de 2019 8:25 a. m. To:
> users@tomcat.apache.org<mailto:users@tomcat.apache.org> Subject: Re: Tomcat 
> 8.5 - Native Library -
> Crash
>
>
> Eduardo,
>
> On 8/21/19 17:36, Eduardo Quintanilla wrote:
>> We have been getting some crashes in Tomcat 8.5.43 lately.
>>
>> The environment is: * JDK 1.8.0_202 * Windows Server 2012 R2
>>
>> The logs shows a tcnative exception.
>>
>> Crash Log: Current thread JavaThread
>> "https-openssl-apr-8081-exec-298" daemon _thread_in_native Java
>> frames: (J=compiled Java code, j=interpreted, Vv=VM code) J
>> 15034
>> org.apache.tomcat.jni.Socket.sendb(JLjava/nio/ByteBuffer;II)I (0
>> bytes) @ 0x0000000002962ddf [0x0000000002962d80+0x5f] J 29164 C2
>> org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper.doWrite(ZLjav
a
>
>>
/nio/ByteBuffer;)V
>> (242 bytes) @ 0x0000000006d6933c [0x0000000006d68b20+0x81c] J
>> 27479 C2 org.apache.tomcat.util.net.SocketWrapperBase.flush(Z)Z
>> (20 bytes) @ 0x00000000053f6144 [0x00000000053f60a0+0xa4] J 24666
>> C2
>> org.apache.coyote.http2.Http2OutputBuffer.doWrite(Ljava/nio/ByteBuffe
r
>
>>
;)I
>> (28 bytes) @ 0x0000000006b51b74 [0x0000000006b51660+0x514] J
>> 24689 C2
>> org.apache.catalina.connector.OutputBuffer.writeBytes([BII)V (38
>> bytes) @ 0x00000000031c09f8 [0x00000000031c04c0+0x538] J 27348
>> C2 org.apache.catalina.connector.CoyoteOutputStream.write([BII)V
>> (26 bytes) @ 0x00000000071d51a8 [0x00000000071d5120+0x88]
>
> What's the actual error? Can you post the entire crash dump?
>
>> Tomcat logs: org.apache.catalina.connector.ClientAbortException:
>> org.apache.coyote.CloseNowException: Connection [214], Stream
>> [279], This stream is not writable
>
> Do you always get the "stream is not writable" error before the
> JVM performs the crash-dump?
>
> I believe there is at least one lingering SEGV hiding in
> Socket.sendb(), possibly only on Windows. I don't have a Windows
> development environment to be able to disassemble the crash dump
> and locate the line of code being executed when the SEGV occurs, so
> I have added NULL-checks to everything I can find in there but it
> looks like it's not enough. Something is missing, somewhere.
>
> -chris
>
>
>
> The information transmitted is intended only for the person or
> entity to which it is addressed and may contain confidential and/or
> privileged material. Any review, retransmission, dissemination or
> other use of, or taking of any action in reliance upon, this
> information by persons or entities other than the intended
> recipient is prohibited. If you received this in error, please
> contact the sender and delete the material from any computer. La
> información transmitida está destinada únicamente a la persona o
> entidad a quien que va dirigida y puede contener información
> confidencial y/o material privilegiado. Cualquier revisión,
> retransmisión, difusión u otros usos, o cualquier acción tomada por
> personas o entidades distintas al destinatario basándose en esta
> información está prohibida. Si usted recibe este mensaje por error,
> por favor contacte al remitente y elimine el material de cualquier
> computadora.
>



The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in reliance upon, this information by persons or entities other than the 
intended recipient is prohibited. If you received this in error, please contact 
the sender and delete the material from any computer.
La información transmitida está destinada únicamente a la persona o entidad a 
quien que va dirigida y puede contener información confidencial y/o material 
privilegiado. Cualquier revisión, retransmisión, difusión u otros usos, o 
cualquier acción tomada por personas o entidades distintas al destinatario 
basándose en esta información está prohibida. Si usted recibe este mensaje por 
error, por favor contacte al remitente y elimine el material de cualquier 
computadora.

Reply via email to