Problem/Motivation
When i do a GET with JSON:API the web server returns a 503 Bad Gateway, instantly. No errors in web, php logs or Drupal logs.
Only in database log i see this error:
"Got an error reading communication packets"
Steps to reproduce
This only happens in a very especial configuration.
I have 3 custom entities:
grandfather <--> father <--> son
Each one referencing the other with an entity reference.
When i do a GET of grandfather it's all ok. The same with grandfather and a includes of field_father (a field in grandfather referencing n fathers).
But if i do a GET with field_father.field_son (field_son is a field in father referencing n son) then the error happens.
If i use the sparse fieldsets to include son fields except the field that is referencing the father it works well.
Real examples:
assessment = grandfather
building_block = father
question = son
Error:
/jsonapi/sst_assessment/sst_assessment/afe6bc64-939a-433b-b593-656a7b1dcb06?include=field_building_blocks_results.field_question_results,field_assessment_template
No error:
/jsonapi/sst_assessment/sst_assessment/afe6bc64-939a-433b-b593-656a7b1dcb06?include=field_building_blocks_results.field_question_results,field_assessment_template&fields[sst_question_result--question_result_si_no]=field_impedimento,field_valor_respuesta,field_question
Comments
Comment #2
cilefen commentedHave you researched "mysql got an error reading communication packets"?
Comment #3
longwaveSometimes this means that
max_allowed_packetin your MySQL configuration is too small, you can try increasing this value.Comment #4
carlitus commentedThanks for the reply @cilefen and @longwave :)
And yes, I have looked at the two things you comment on and it seems that the error is not there.
Comment #5
longwaveThe title says circular reference, is there actually a circular reference here (so grandfather -> father -> son -> grandfather or similar)?
As custom code is involved it is difficult to help without access to that code, perhaps you can reproduce this by adding similar entity references to nodes?