StatusException and StatusRuntimeException not serializable
- Lenguaje dominante
- Java
- Estrellas
- 12.1k
- Forks
- 4k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 37
Descripción
StatusException and StatusRuntimeException are not serializable due to containing a Status object (which makes no attempt to be serializable) with no special handling.
Here's a snippet from the exception that arises:
```
... snip ...
Caused by: java.io.NotSerializableException: io.grpc.Status
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:441)
at java.lang.Throwable.writeObject(Throwable.java:985)
at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
... snip ...
```
Our use case is an RMI-like API to make calls to a server process which is then making gRPC calls. In this case an operation failed and then things go really wrong because we can't see the root problem since the real exception can't be serialized.
I think to be a "good citizen" the Status*Exceptions should be serializable so it would seem that either:
- Status should also be
- The status should be pulled apart and the pieces stored in the exception classes
- Special serialization routines should be put in place to pull the Status apart on write and put them back together on read
If you know which approach you'd like to take, I'd be happy to implement it.
Guía de contribución
Línea de trabajo
Comienza con las clases StatusException y StatusRuntimeException y reproduce la serialización usando el fallo mostrado en el issue. Compara las posibles formas de manejar el Status contenido y decide cómo deben conservar su información de estado las excepciones serializadas; se considera terminado cuando ambos tipos de excepción se serializan y deserializan sin NotSerializableException.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- backend-api-design
- Tipo de issue
- Error
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100