OkHttp TlsTest TSAN data race
- Lingua principale
- Java
- Stelle
- 12.1k
- Fork
- 4k
- Merge medio
- 2g 17h
- PR unite (30g)
- 37
Descrizione
The bug described in #10284 was fixed by placing locks and removing the use of the bareSocket in #10279. Fixing this bug uncovered another underlying issue from a different code path.
[TSAN](https://fusion2.corp.google.com/invocations/261cd145-0fd1-4fb0-b45b-8f7b5fc7d368/targets/%2F%2Fthird_party%2Fjava_src%2Fgrpc%2Fokhttp:src%2Ftest%2Fjava%2Fio%2Fgrpc%2Fokhttp%2FTlsTest/tests) reports:
```
SanitizerError
ThreadSanitizer: data race Cipher.java:1790 in javax.crypto.Cipher.checkCipherState()V (//third_party/java_src/grpc/okhttp:src/test/java/io/grpc/okhttp/TlsTest); see [http://go/sanitizer-blaze-warning](https://www.google.com/url?q=http://go/sanitizer-blaze-warning&sa=D)
```
```
Details
==================
WARNING: ThreadSanitizer: data race (pid=507)
Read of size 4 at 0x0000cebeef54 by thread T56:
#0 javax.crypto.Cipher.checkCipherState()V Cipher.java:1790
#1 javax.crypto.Cipher.doFinal()[B Cipher.java:2083
#2 sun.security.ssl.SSLCipher$T12GcmReadCipherGenerator$GcmReadCipher.dispose()V SSLCipher.java:1684
#3 sun.security.ssl.InputRecord.close()V InputRecord.java:103
#4 sun.security.ssl.TransportContext.initiateInboundClose()V TransportContext.java:545
#5 sun.security.ssl.TransportContext.closeInbound()V TransportContext.java:497
#6 sun.security.ssl.SSLSocketImpl.shutdownInput(Z)V SSLSocketImpl.java:847
#7 sun.security.ssl.SSLSocketImpl.bruteForceCloseInput(Z)V SSLSocketImpl.java:799
#8 sun.security.ssl.SSLSocketImpl.duplexCloseOutput()V SSLSocketImpl.java:661
#9 sun.security.ssl.SSLSocketImpl.close()V SSLSocketImpl.java:585
#10 sun.security.ssl.SSLSocketImpl$AppOutputStream.close()V SSLSocketImpl.java:1329
#11 okio.OutputStreamSink.close()V JvmOkio.kt:72
#12 okio.AsyncTimeout$sink$1.close()V AsyncTimeout.kt:109
#13 io.grpc.okhttp.AsyncSink$3.run()V AsyncSink.java:209
#14 io.grpc.internal.SerializingExecutor.run()V SerializingExecutor.java:133
#15 java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V ThreadPoolExecutor.java:1130
#16 java.util.concurrent.ThreadPoolExecutor$Worker.run()V ThreadPoolExecutor.java:630
#17 java.lang.Thread.run()V Thread.java:830
#18 (Generated Stub)
Previous write of size 4 at 0x0000cebeef54 by thread T57:
#0 javax.crypto.Cipher.init(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/SecureRandom;)V Cipher.java:1438
#1 sun.security.ssl.SSLCipher$T12GcmReadCipherGenerator$GcmReadCipher.decrypt(BLjava/nio/ByteBuffer;[B)Lsun/security/ssl/Plaintext; SSLCipher.java:1636
#2 sun.security.ssl.SSLSocketInputRecord.decodeInputRecord()[Lsun/security/ssl/Plaintext; SSLSocketInputRecord.java:260
#3 sun.security.ssl.SSLSocketInputRecord.decode([Ljava/nio/ByteBuffer;II)[Lsun/security/ssl/Plaintext; SSLSocketInputRecord.java:181
#4 sun.security.ssl.SSLTransport.decode(Lsun/security/ssl/TransportContext;[Ljava/nio/ByteBuffer;II[Ljava/nio/ByteBuffer;II)Lsun/security/ssl/Plaintext; SSLTransport.java:111
#5 sun.security.ssl.SSLSocketImpl.decode(Ljava/nio/ByteBuffer;)Lsun/security/ssl/Plaintext; SSLSocketImpl.java:1509
#6 sun.security.ssl.SSLSocketImpl.readApplicationRecord(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; SSLSocketImpl.java:1476
#7 sun.security.ssl.SSLSocketImpl$AppInputStream.read([BII)I SSLSocketImpl.java:1065
#8 okio.InputStreamSource.read(Lokio/Buffer;J)J JvmOkio.kt:94
#9 okio.AsyncTimeout$source$1.read(Lokio/Buffer;J)J AsyncTimeout.kt:125
#10 okio.RealBufferedSource.request(J)Z RealBufferedSource.kt:206
#11 okio.RealBufferedSource.require(J)V RealBufferedSource.kt:199
#12 io.grpc.okhttp.internal.framed.Http2$Reader.nextFrame(Lio/grpc/okhttp/internal/framed/FrameReader$Handler;)Z Http2.java:120
#13 io.grpc.okhttp.OkHttpClientTransport$ClientFrameHandler.run()V OkHttpClientTransport.java:1105
#14 java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V ThreadPoolExecutor.java:1130
#15 java.util.concurrent.ThreadPoolExecutor$Worker.run()V ThreadPoolExecutor.java:630
#16 java.lang.Thread.run()V Thread.java:830
#17 (Generated Stub)
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
The failure is in TlsTest, with the trace passing through AsyncSink.java and OkHttpClientTransport.java. Start by running the TSAN target named in the issue and inspect the concurrent input and output paths. Done means the TlsTest race is resolved and the TSAN run no longer reports it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- networking, testing-qa
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100