[tomcat] branch master updated: Remove extra FileInfo

2019-07-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 04fb212  Remove extra FileInfo
04fb212 is described below

commit 04fb212a2b34c5d5dbcc997781ead461c5228730
Author: remm 
AuthorDate: Thu Jul 18 10:12:34 2019 +0200

Remove extra FileInfo
---
 res/tomcat-maven/tomcat-jni.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/res/tomcat-maven/tomcat-jni.json b/res/tomcat-maven/tomcat-jni.json
index 1ca1093..a72c482 100644
--- a/res/tomcat-maven/tomcat-jni.json
+++ b/res/tomcat-maven/tomcat-jni.json
@@ -1,8 +1,7 @@
 [
+{ "name":"org.apache.tomcat.jni.Error" },
 { "name":"org.apache.tomcat.jni.FileInfo" },
 { "name":"org.apache.tomcat.jni.Sockaddr" },
-{ "name":"org.apache.tomcat.jni.FileInfo" },
-{ "name":"org.apache.tomcat.jni.Error" },
 { "name":"org.apache.tomcat.jni.SSL", 
"methods":[{"name":"newSSL","parameterTypes":["long","boolean"]}] },
 { "name":"java.lang.String", 
"methods":[{"name":"","parameterTypes":["byte[]"]},{"name":"getBytes","parameterTypes":[]}]
 }
 ]


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Graal and Tomcat Native

2019-07-18 Thread Rainer Jung

Hi Jean-Frederic and Rémy,

I do not have a real answer, but a workaround. It is possible to get the 
same result without any printf style functions or atoi, just by doing 
arithmetics. But: maybe then the crash simply moves to another position.


In src/ssl.c you can use:

static int ssl_rand_choosenum(int l, int h)
{
double dbl;
int i;

dbl = 1.0 * (rand() % RAND_MAX) * (h - l);
i = (dbl / RAND_MAX + 0.5) + 1;
if (i < l) i = l;
if (i > h) i = h;
return i;
}

This will also be much faster.

I tested the formula against the original one for each value of l and h 
Note, that currently the function is always called with l==0 and h==127! 
So you could also drop the h and l params and use fixed values, but of 
course would loose future flexibility.


between 0 and 499 (and h>=l) and for each seed between 0 and 499 on twi 
different architectures (Linux 64 Bit on x64 and Solaris Sparc 32 Bit).
You can run the following test program to convince yourself about the 
formula correctness on your platform:


#include 
#include 

#define MAX_SEED 500
#define MAX_BOUNDARY 500
#define FEEDBACK 10

int main ()
{
int seed;
int l;
int h;
int i1;
int i2;
int rand_orig;
int rand_reduced;
double rand_normalized;
double rand_prod;
char buf[50];
long count = 0;

fprintf(stdout, "RAND_MAX is %d\n", RAND_MAX);
fprintf(stdout, "Number of tests to run: %ld\n", 
1L*MAX_BOUNDARY*MAX_BOUNDARY/2*MAX_SEED);

fprintf(stdout, "Feedback dot every %d tests\n", FEEDBACK);
fprintf(stdout, "Expect %d feedback dots\n", 
1L*MAX_BOUNDARY*MAX_BOUNDARY/2*MAX_SEED / FEEDBACK);


fprintf(stdout, 
"l\th\tseed\trand\tred\tnorm\torig\tnew\tprod\tround\n");

fflush(stdout);

for (seed = 0; seed < MAX_SEED; seed++) {
srand(seed);
for (l = 0; l < MAX_BOUNDARY; l++) {
for (h = l; h < MAX_BOUNDARY; h++) {
rand_orig = rand();
rand_reduced = rand_orig % RAND_MAX;

rand_normalized = ((double)rand_reduced / RAND_MAX) * 
(h - l);

/* %.0f does rounding */
sprintf(buf, "%.0f", rand_normalized);
i1 = atoi(buf) + 1;
if (i1 < l) i1 = l;
if (i1 > h) i1 = h;

rand_prod = 1.0 * rand_reduced * (h - l);
i2 = (rand_prod / RAND_MAX + 0.5) + 1;
if (i2 < l) i2 = l;
if (i2 > h) i2 = h;

if (i1 != i2) {
fprintf(stdout, "%d\t%d\t%d\t%d\t%d\t%f\t%d\t%d\t%f\n",
l, h, seed, rand_orig, rand_reduced, 
rand_normalized,

i1, i2, rand_prod);
}
count++;
if (count % FEEDBACK == 0) {
fprintf(stderr, ".");
fflush(stderr);
}
}
}
}
}

Regards,

Rainer

Am 18.07.2019 um 08:57 schrieb jean-frederic clere:

On 12/07/2019 11:21, Rémy Maucherat wrote:

On Thu, Jul 11, 2019 at 11:01 PM Rainer Jung mailto:rainer.j...@kippdata.de>> wrote:

 Am 11.07.2019 um 22:10 schrieb Rémy Maucherat:
 > On Thu, Jul 11, 2019 at 8:42 PM Rainer Jung
 mailto:rainer.j...@kippdata.de>
 > >>
 wrote:
 >
 >     Hi Rémy,
 >
 >     When one looks up the macros in native/include/tcn.h, this boils
 >     down to
 >     the following returning null:
 >
 >     (*env)->FindClass(env, "org/apache/tomcat/jni/FileInfo")
 >
 >     So our own FileInfo class can not be found. FindClass docs
 indicate its
 >     searched in the CLASSPATH although I'm not sure whether its
 really the
 >     classpath or some search paths of a class loader hierarchy.
 >
 >     You might want to add the JVM commandline flag
 "-verbose:class" for any
 >     easy way to track class loading.
 >
 >     I didn't really grok what you meant with "define in JNI
 configuration".
 >     For normal JVMs the code just works, so what might be special
 for Graal
 >     that org.apache.tomcat.jni.FileInfo can't be found?
 >
 >
 > A Graal native image is indeed not a normal JVM and does not
 support any
 > kind of dynamic class loading, it has to be declared first in these
 > configuration files.

 Ah OK.

 > So I am adding this to the jni one:
 > { "name":"org.apache.tomcat.jni.FileInfo" },
 > { "name":"org.apache.tomcat.jni.Sockaddr" },
 > { "name":"org.apache.tomcat.jni.FileInfo" },

 Again FileInfo? I think instead "org.apache.tomcat.jni.Error" should be
 the third one.

 > { "name":"java.lang.String", "methods" :
 >
 
[{"name":"","parameterTypes":["byte[]"]},{"name":"getBytes","parameterTypes":[]}]

 > }
 > And loading now works.
 > Jul 11, 2019 9:39:28 PM org.apache.catalina.core.

[Bug 63571] The SSL sessionCacheSize config overwrites javax.net.ssl.sessionCacheSize

2019-07-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63571

Christopher Schultz  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #1 from Christopher Schultz  ---
In Tomcat 9, the call to SSLSessionContext.setSessionCacheSize is not made
unless the session cache size is > 0 [1]. Since the default is zero0, Tomcat
should already be behaving as you describe.

Is it possible that this value is being overwritten in some other way?

[1]
https://github.com/apache/tomcat/blob/master/java/org/apache/tomcat/util/net/SSLUtilBase.java#L260

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63570] NioEndpoint.populateLocalAddr() populates remote address

2019-07-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63570

--- Comment #2 from Aditya K  ---
(In reply to Remy Maucherat from comment #1)
> Sorry for the trouble, the fix will be in Tomcat 9.0.23.

Thank you.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63571] The SSL sessionCacheSize config overwrites javax.net.ssl.sessionCacheSize

2019-07-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63571

--- Comment #2 from Letu Yang  ---
Hi Christopher,

Thank you for the reply! I should have raised this against Tomcat 7... Please
feel free to close it.

https://github.com/apache/tomcat/blob/7.0.x/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java#L624

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63571] The SSL sessionCacheSize config overwrites javax.net.ssl.sessionCacheSize

2019-07-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63571

--- Comment #3 from Letu Yang  ---
Or shall we fix it in Tomcat 7 as well, making it consistent with 8 and 9?

https://github.com/apache/tomcat/blob/7.0.x/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java#L638

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63568] Allow keeping tcpNoDelay untouched (default)

2019-07-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63568

--- Comment #1 from Remy Maucherat  ---
Since it's probably not a good idea to change the default behavior at this
point, the "hotfix" proposed does not sound that bad.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org