Re: RFR: 8257707: Fix incorrect format string in Http1HeaderParser

2020-12-03 Thread Aleksey Shipilev
On Sat, 28 Nov 2020 19:42:01 GMT, Turbanov Andrey 
 wrote:

> Incorrect format string was found by IntelliJ IDEA inspection `Java | 
> Probable bugs | Malformed format string`

Submitted: https://bugs.openjdk.java.net/browse/JDK-8257707 -- rename this PR 
to "8257707: Fix incorrect format string in Http1HeaderParser" to get it hooked 
here. Also, merge from master to get Windows builds fixed and re-tested.

-

PR: https://git.openjdk.java.net/jdk/pull/1495


RFR: 8257707: Fix incorrect format string in Http1HeaderParser

2020-12-03 Thread Turbanov Andrey
Incorrect format string was found by IntelliJ IDEA inspection `Java | Probable 
bugs | Malformed format string`

-

Commit messages:
 - [PATCH] Fix incorrect format string in Http1HeaderParser

Changes: https://git.openjdk.java.net/jdk/pull/1495/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1495&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8257707
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1495.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1495/head:pull/1495

PR: https://git.openjdk.java.net/jdk/pull/1495


Re: RFR: 8257707: Fix incorrect format string in Http1HeaderParser

2020-12-03 Thread Daniel Fuchs
On Thu, 3 Dec 2020 17:42:00 GMT, Aleksey Shipilev  wrote:

>> Incorrect format string was found by IntelliJ IDEA inspection `Java | 
>> Probable bugs | Malformed format string`
>
> Submitted: https://bugs.openjdk.java.net/browse/JDK-8257707 -- rename this PR 
> to "8257707: Fix incorrect format string in Http1HeaderParser" to get it 
> hooked here. Also, merge from master to get Windows builds fixed and 
> re-tested.

Hi Andrei,

Thanks for finding this. Could you run the HttpClient tests - and if they pass 
I'll sponsor the changes.

jtreg  -verbose:summary -a -ea -esa -agentvm -conc:4 -ignore:quiet -timeout:2 
-jdk: test/jdk/java/net/httpclient

Alternatively you can run tier2 tests - which include the HttpClient changes:

make test-tier2

(but that's going to run many more tests)

best regards,

-- daniel

-

PR: https://git.openjdk.java.net/jdk/pull/1495


Re: RFR: 8257707: Fix incorrect format string in Http1HeaderParser

2020-12-03 Thread Andrey Turbanov
On Thu, 3 Dec 2020 19:01:12 GMT, Daniel Fuchs  wrote:

>> Submitted: https://bugs.openjdk.java.net/browse/JDK-8257707 -- rename this 
>> PR to "8257707: Fix incorrect format string in Http1HeaderParser" to get it 
>> hooked here. Also, merge from master to get Windows builds fixed and 
>> re-tested.
>
> Hi Andrey,
> 
> Thanks for finding this. Could you run the HttpClient tests - and if they 
> pass I'll sponsor the changes.
> 
> jtreg  -verbose:summary -a -ea -esa -agentvm -conc:4 -ignore:quiet -timeout:2 
> -jdk: test/jdk/java/net/httpclient
> 
> Alternatively you can run tier2 tests - which include the HttpClient changes:
> 
> make test-tier2
> 
> (but that's going to run many more tests)
> 
> best regards,
> 
> -- daniel

make test-tier2 fails with error on my machine: :(
user@WORK-PC /cygdrive/f/Projects/official_openjdk
$ make test-tier2
Building target 'test-tier2' in configuration 'windows-x86_64-server-release'
Compiling 127 files for java.compiler
Compiling 10 files for java.instrument
Compiling 18 files for java.datatransfer
Compiling 35 files for java.logging
Compiling 330 files for java.management
Compiling 141 files for java.net.http
Compiling 5 files for java.transaction.xa
Compiling 15 files for java.scripting
Compiling 22 files for java.smartcardio
Compiling 204 files for jdk.internal.vm.ci
Compiling 24 files for jdk.management
Compiling 9 files for jdk.unsupported
Compiling 60 files for jdk.internal.jvmstat
Compiling 131 files for jdk.charsets
Compiling 35 files for jdk.crypto.ec
Compiling 11 files for jdk.crypto.mscapi
Compiling 68 files for jdk.dynalink
Compiling 403 files for jdk.compiler
Compiling 3 files for jdk.internal.ed
Compiling 44 files for jdk.httpserver
Compiling 59 files for jdk.incubator.foreign
Compiling 50 files for jdk.incubator.vector
Compiling 51 files for jdk.internal.opt
Compiling 30 files for jdk.jartool
Compiling 109 files for jdk.internal.le
Compiling 1 files for jdk.jdwp.agent
Compiling 201 files for jdk.jfr
Compiling 4 files for jdk.jsobject
Compiling 8 files for jdk.net
Compiling 1814 files for jdk.localedata
Compiling 2 files for jdk.nio.mapmode
Compiling 25 files for jdk.sctp
Compiling 14 files for jdk.zipfs
Compiling 30 files for java.security.sasl
Compiling 15 files for jdk.attach
Compiling 74 files for jdk.crypto.cryptoki
Compiling 14 files for jdk.management.jfr
Compiling 136 files for jdk.jdeps
Compiling 198 files for java.naming
Compiling 40 files for jdk.jcmd
Compiling 256 files for jdk.jdi
Compiling 131 files for java.rmi
Compiling 82 files for jdk.jlink
Compiling 224 files for java.security.jgss
Compiling 16 files for jdk.naming.dns
Compiling 16 files for java.management.rmi
Compiling 11 files for jdk.jstatd
Compiling 8 files for jdk.naming.rmi
Compiling 31 files for jdk.management.agent
Compiling 30 files for jdk.security.auth
Compiling 16 files for jdk.security.jgss
Compiling 1845 files for java.xml
./build/windows-x86_64-server-release/hotspot/variant-server/gensrc/jvmtifiles/bytecodeInterpreterWithChecks.cpp(3):
 fatal error C1083: Cannot open include file: 
'interpreter/bytecodeInterpreter.cpp': No such file or directory
make[3]: *** [lib/CompileJvm.gmk:143: 
/cygdrive/f/Projects/official_openjdk/build/windows-x86_64-server-release/hotspot/variant-server/libjvm/objs/bytecodeInterpreterWithChecks.obj]
 Error 1
make[3]: *** Waiting for unfinished jobs
make[2]: *** [make/Main.gmk:252: hotspot-server-libs] Error 2
make[2]: *** Waiting for unfinished jobs

ERROR: Build failed for target 'test-tier2' in configuration 
'windows-x86_64-server-release' (exit code 2)
Stopping sjavac server

=== Output from failing command(s) repeated here ===
* For target 
hotspot_variant-server_libjvm_objs_bytecodeInterpreterWithChecks.obj:
bytecodeInterpreterWithChecks.cpp
./build/windows-x86_64-server-release/hotspot/variant-server/gensrc/jvmtifiles/bytecodeInterpreterWithChecks.cpp(3):
 fatal error C1083: Cannot open include file: 
'interpreter/bytecodeInterpreter.cpp': No such file or directory

* All command lines available in 
/cygdrive/f/Projects/official_openjdk/build/windows-x86_64-server-release/make-support/failure-logs.
=== End of repeated output ===

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See doc/building.html#troubleshooting for assistance.

make[1]: *** [/cygdrive/f/Projects/official_openjdk/make/Init.gmk:315: main] 
Ошибка 2
make: *** [/cygdrive/f/Projects/official_openjdk/make/Init.gmk:186: test-tier2] 
Ошибка 2

-

PR: https://git.openjdk.java.net/jdk/pull/1495


RFR: 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE happens

2020-12-03 Thread Yasumasa Suenaga
`InputStream` from `BodyPublishers.ofInputStream()` is usually closed when the 
stream reaches EOF. However IOE handler returns without closing.

I confirmed this problem in `BodyPublishers.ofInputStream()`, but I think 
`BodyPublishers.ofFile()`has same problem because it also use 
`StreamIterator`as well as `ofInputStream()`.


# How to reproduce:

Following code (Test.java) attempts to post body from `TestInputStream` which 
throws IOE in `read()`. "close called" is shown on the console if `close()` is 
called.

import java.io.*;
import java.net.*;
import java.net.http.*;

public class Test{

  private static class TestInputStream extends InputStream{

public TestInputStream(){
  super();
  System.out.println("test c'tor");
}

@Override
public int read() throws IOException{
  System.out.println("read called");
  throw new IOException("test");
}

@Override
public void close() throws IOException{
  System.out.println("close called");
  super.close();
}

  }

  public static void main(String[] args) throws Exception{
var http = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
 .uri(URI.create("http://httpbin.org/post";))
 .POST(HttpRequest.BodyPublishers.ofInputStream(() 
-> new TestInputStream()))
 .build();
http.send(request, HttpResponse.BodyHandlers.discarding());
System.out.println("Press any key to exit...");
System.in.read();
  }
}

-

Commit messages:
 - 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE 
happens

Changes: https://git.openjdk.java.net/jdk/pull/1614/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1614&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8257736
  Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1614.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1614/head:pull/1614

PR: https://git.openjdk.java.net/jdk/pull/1614


Re: RFR: 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE happens

2020-12-03 Thread Yasumasa Suenaga
On Fri, 4 Dec 2020 00:47:51 GMT, Yasumasa Suenaga  wrote:

> `InputStream` from `BodyPublishers.ofInputStream()` is usually closed when 
> the stream reaches EOF. However IOE handler returns without closing.
> 
> I confirmed this problem in `BodyPublishers.ofInputStream()`, but I think 
> `BodyPublishers.ofFile()`has same problem because it also use 
> `StreamIterator`as well as `ofInputStream()`.
> 
> 
> # How to reproduce:
> 
> Following code (Test.java) attempts to post body from `TestInputStream` which 
> throws IOE in `read()`. "close called" is shown on the console if `close()` 
> is called.
> 
> import java.io.*;
> import java.net.*;
> import java.net.http.*;
> 
> public class Test{
> 
>   private static class TestInputStream extends InputStream{
> 
> public TestInputStream(){
>   super();
>   System.out.println("test c'tor");
> }
> 
> @Override
> public int read() throws IOException{
>   System.out.println("read called");
>   throw new IOException("test");
> }
> 
> @Override
> public void close() throws IOException{
>   System.out.println("close called");
>   super.close();
> }
> 
>   }
> 
>   public static void main(String[] args) throws Exception{
> var http = HttpClient.newHttpClient();
> var request = HttpRequest.newBuilder()
>  .uri(URI.create("http://httpbin.org/post";))
>  
> .POST(HttpRequest.BodyPublishers.ofInputStream(() -> new TestInputStream()))
>  .build();
> http.send(request, HttpResponse.BodyHandlers.discarding());
> System.out.println("Press any key to exit...");
> System.in.read();
>   }
> }

Test failure in HotSpot on macOS does not seem to be  caused by this change.

-

PR: https://git.openjdk.java.net/jdk/pull/1614


Re: RFR: 8257707: Fix incorrect format string in Http1HeaderParser

2020-12-03 Thread Aleksey Shipilev
On Thu, 3 Dec 2020 20:05:36 GMT, Andrey Turbanov 
 wrote:

> === Output from failing command(s) repeated here ===
> * For target 
> hotspot_variant-server_libjvm_objs_bytecodeInterpreterWithChecks.obj:
> bytecodeInterpreterWithChecks.cpp
> ./build/windows-x86_64-server-release/hotspot/variant-server/gensrc/jvmtifiles/bytecodeInterpreterWithChecks.cpp(3):
>  fatal error C1083: Cannot open include file: 
> 'interpreter/bytecodeInterpreter.cpp': No such file or directory

That's the build failure, actually, and `bytecodeInterpreterWithChecks.cpp` 
should have been long gone. Run `git clean` on your repo?

-

PR: https://git.openjdk.java.net/jdk/pull/1495


Re: RFR: 8257707: Fix incorrect format string in Http1HeaderParser

2020-12-03 Thread Aleksey Shipilev
On Fri, 4 Dec 2020 06:33:35 GMT, Aleksey Shipilev  wrote:

>> make test-tier2 fails with error on my machine: :(
>> user@WORK-PC /cygdrive/f/Projects/official_openjdk
>> $ make test-tier2
>> Building target 'test-tier2' in configuration 'windows-x86_64-server-release'
>> Compiling 127 files for java.compiler
>> Compiling 10 files for java.instrument
>> Compiling 18 files for java.datatransfer
>> Compiling 35 files for java.logging
>> Compiling 330 files for java.management
>> Compiling 141 files for java.net.http
>> Compiling 5 files for java.transaction.xa
>> Compiling 15 files for java.scripting
>> Compiling 22 files for java.smartcardio
>> Compiling 204 files for jdk.internal.vm.ci
>> Compiling 24 files for jdk.management
>> Compiling 9 files for jdk.unsupported
>> Compiling 60 files for jdk.internal.jvmstat
>> Compiling 131 files for jdk.charsets
>> Compiling 35 files for jdk.crypto.ec
>> Compiling 11 files for jdk.crypto.mscapi
>> Compiling 68 files for jdk.dynalink
>> Compiling 403 files for jdk.compiler
>> Compiling 3 files for jdk.internal.ed
>> Compiling 44 files for jdk.httpserver
>> Compiling 59 files for jdk.incubator.foreign
>> Compiling 50 files for jdk.incubator.vector
>> Compiling 51 files for jdk.internal.opt
>> Compiling 30 files for jdk.jartool
>> Compiling 109 files for jdk.internal.le
>> Compiling 1 files for jdk.jdwp.agent
>> Compiling 201 files for jdk.jfr
>> Compiling 4 files for jdk.jsobject
>> Compiling 8 files for jdk.net
>> Compiling 1814 files for jdk.localedata
>> Compiling 2 files for jdk.nio.mapmode
>> Compiling 25 files for jdk.sctp
>> Compiling 14 files for jdk.zipfs
>> Compiling 30 files for java.security.sasl
>> Compiling 15 files for jdk.attach
>> Compiling 74 files for jdk.crypto.cryptoki
>> Compiling 14 files for jdk.management.jfr
>> Compiling 136 files for jdk.jdeps
>> Compiling 198 files for java.naming
>> Compiling 40 files for jdk.jcmd
>> Compiling 256 files for jdk.jdi
>> Compiling 131 files for java.rmi
>> Compiling 82 files for jdk.jlink
>> Compiling 224 files for java.security.jgss
>> Compiling 16 files for jdk.naming.dns
>> Compiling 16 files for java.management.rmi
>> Compiling 11 files for jdk.jstatd
>> Compiling 8 files for jdk.naming.rmi
>> Compiling 31 files for jdk.management.agent
>> Compiling 30 files for jdk.security.auth
>> Compiling 16 files for jdk.security.jgss
>> Compiling 1845 files for java.xml
>> ./build/windows-x86_64-server-release/hotspot/variant-server/gensrc/jvmtifiles/bytecodeInterpreterWithChecks.cpp(3):
>>  fatal error C1083: Cannot open include file: 
>> 'interpreter/bytecodeInterpreter.cpp': No such file or directory
>> make[3]: *** [lib/CompileJvm.gmk:143: 
>> /cygdrive/f/Projects/official_openjdk/build/windows-x86_64-server-release/hotspot/variant-server/libjvm/objs/bytecodeInterpreterWithChecks.obj]
>>  Error 1
>> make[3]: *** Waiting for unfinished jobs
>> make[2]: *** [make/Main.gmk:252: hotspot-server-libs] Error 2
>> make[2]: *** Waiting for unfinished jobs
>> 
>> ERROR: Build failed for target 'test-tier2' in configuration 
>> 'windows-x86_64-server-release' (exit code 2)
>> Stopping sjavac server
>> 
>> === Output from failing command(s) repeated here ===
>> * For target 
>> hotspot_variant-server_libjvm_objs_bytecodeInterpreterWithChecks.obj:
>> bytecodeInterpreterWithChecks.cpp
>> ./build/windows-x86_64-server-release/hotspot/variant-server/gensrc/jvmtifiles/bytecodeInterpreterWithChecks.cpp(3):
>>  fatal error C1083: Cannot open include file: 
>> 'interpreter/bytecodeInterpreter.cpp': No such file or directory
>> 
>> * All command lines available in 
>> /cygdrive/f/Projects/official_openjdk/build/windows-x86_64-server-release/make-support/failure-logs.
>> === End of repeated output ===
>> 
>> No indication of failed target found.
>> Hint: Try searching the build log for '] Error'.
>> Hint: See doc/building.html#troubleshooting for assistance.
>> 
>> make[1]: *** [/cygdrive/f/Projects/official_openjdk/make/Init.gmk:315: main] 
>> Ошибка 2
>> make: *** [/cygdrive/f/Projects/official_openjdk/make/Init.gmk:186: 
>> test-tier2] Ошибка 2
>
>> === Output from failing command(s) repeated here ===
>> * For target 
>> hotspot_variant-server_libjvm_objs_bytecodeInterpreterWithChecks.obj:
>> bytecodeInterpreterWithChecks.cpp
>> ./build/windows-x86_64-server-release/hotspot/variant-server/gensrc/jvmtifiles/bytecodeInterpreterWithChecks.cpp(3):
>>  fatal error C1083: Cannot open include file: 
>> 'interpreter/bytecodeInterpreter.cpp': No such file or directory
> 
> That's the build failure, actually, and `bytecodeInterpreterWithChecks.cpp` 
> should have been long gone. Run `git clean` on your repo?

FWIW, this passes with the patch:

$ CONF=linux-x86_64-server-fastdebug make images run-test 
TEST=java/net/httpclient
==
Test summary
==
   TEST  TOTAL  PASS  FAIL ERROR   
   jtreg:test/jdk/java/net/httpclient  21