Serialization exception on remote schema error
See original GitHub issueDescribe the bug As part of introducing test seams into our application we’ve added a delegating handler to the http clients used to communicate with remote schemas. This allows us to simulate them being unavailable. The core code for this handler looks like the following:
if (IsServiceUnavailable(request)) {
return new HttpResponseMessage {
StatusCode = HttpStatusCode.ServiceUnavailable,
Content = new StringContent(""),
ReasonPhrase = $"Service '{_schemaName}' unavailable due to test configuration"
};
} else {
return await base.SendAsync(request, cancellationToken);
}
When the unavailable response is triggered we see the initiating request to the the stitched schema fail with a 500 error.
The stack trace in the logs includes the following:
Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'ManifestModule' with type 'System.Reflection.RuntimeModule'. Path 'errors[0].extensions.remote.Exception.TargetSite.Module.Assembly'.
at bool Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)
at bool Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, out JsonContract memberContract, out object memberValue)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at void Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, object value, Type objectType) at void Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, object value, Type objectType)
at string Newtonsoft.Json.JsonConvert.SerializeObjectInternal(object value, Type type, JsonSerializer jsonSerializer)
at async Task HotChocolate.Execution.JsonQueryResultSerializer.SerializeAsync(IReadOnlyQueryResult result, Stream stream) in C:/hc/src/Core/Core/Execution/JsonQueryResultSerializer.cs:line 38
at async Task HotChocolate.AspNetCore.QueryMiddlewareBase.WriteResponseAsync(HttpResponse response, IExecutionResult executionResult) in C:/hc/src/Server/AspNetCore/QueryMiddlewareBase.cs:line 221
at async Task HotChocolate.AspNetCore.QueryMiddlewareBase.HandleRequestAsync(HttpContext context, IQueryExecutor queryExecutor) in C:/hc/src/Server/AspNetCore/QueryMiddlewareBase.cs:line 208
at async Task HotChocolate.AspNetCore.QueryMiddlewareBase.InvokeAsync(HttpContext context) in C:/hc/src/Server/AspNetCore/QueryMiddlewareBase.cs:line 117
Expected behavior I would expect the stitched schema to return a 200 response with the details of the unavailable remote schema included in the errors collection and the results of any other remote schema to be returned.
Additional context
This is with Hot Chocolate 0.8.1
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Serialization exception on remote schema error · Issue #692
That looks kind of ok. The exception property is only serialized in the snapshot but not on the result serialization. The thing that...
Read more >SerializationException: Error deserializing Avro message
As far as I can see it tries to convert record in topic with io.confluent.connect.avro.AvroConverter. Now should I define the schema (I ...
Read more >Deserialization error [Causes and Cure]
The ABAP proxy tries to parse that XML and populate the ABAP objects -- this is called DESERIALIZATION. The way ABAP proxy parses...
Read more >Compaction Exception after schema change
Symptom. After drop a column from the table schema, compaction fails with the exception in the system.log and debug.log. ERROR [ ...
Read more >Date Serialization Error- GetRecordSet64
JHarolds error implies that the database schema has been altered. In that case I would suggest checking if any custom columns have been...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After looking at it … I see the error now. The problem is that we are not removing the error from the error in the extensions. That is why your clear extension fix remedies this issue.
I haven’t been able to recreate the issue in your unit tests yet but I’ve found that adding an error filter that clears the extensions works around this.
On a related note, it seems that we’re potentially leaking exception information in the
extension.remote.Exception.
path of this exception such as stack trace.