Make ServerImpl's internalClose thread-safe
- Lenguaje dominante
- Java
- Estrellas
- 12.1k
- Forks
- 4k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 37
Descripción
So we have this in `ServerImpl.JumpToApplicationThreadServerStreamListener`:
```java
/**
* Like {@link ServerCall#close(Status, Metadata)}, but thread-safe for internal use.
*/
private void internalClose() {
// TODO(ejona86): this is not thread-safe :)
stream.close(Status.UNKNOWN, new Metadata());
}
```
We should fix that. There's two ways to fix this:
1. Allow truncated messages in our stream and deliver trailers. This would be nicest and would be helpful in other cases (like if too many requests are sent in a server call), as we can deliver a message to the client
2. Treat this as a cancel and send RST_STREAM. This would be similar to client-side cancellation, but we'd still need to verify it'd be safe on server-side.
In either case it'd probably be good if we made this trigger onCancel instead of onCompleted. That'd probably happen naturally for (2), but (1) would need special plumbing, but it's probably not too onerous.
Guía de contribución
Línea de trabajo
Comienza en ServerImpl.JumpToApplicationThreadServerStreamListener y sigue internalClose a través de stream.close. Compara las alternativas de truncated-message/trailers y cancellation, incluido su comportamiento de onCancel frente a onCompleted; se considera terminado cuando internalClose es seguro para subprocesos y se verifican las semánticas resultantes de los callbacks.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- api, backend
- Tipo de issue
- Error
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100