HTTP 502 Bad 'Bad Gateway' error in cleanup/orphans
The method https://transfer-qa.siscc.org/1.2/cleanup/orphans doesn't work on qa:stable. After 30 seconds (timeout?), I'm getting an HTTP 502 'Bad Gateway' error:
Error: Server Error
The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.
Proposed technical solution (as discussed in dev meeting)
- Make method asynchronous
- Return an transaction ID like in
init/mappingSets
{ "success": true, "message": "The request with ID 7123 was successfully registered.", "detail": null }
- Send an email when the transaction is finished
Completed with warning(s): .Stat data request for '*' in 'qa:stable' (ID 7123) Summary - Request ID: 7123 - Data source: - Destination data space: qa:stable - Dataflow: * - User: jensXXXXX - Completion status: Completed Log messages Date Level Message 03/07/2022 09:25:44 NOTICE The request with ID 7123 was successfully registered. 03/07/2022 09:27:56 WARN The dataflow ILO:DF_SDG_A871_SEX_AGE_RT(1.0) cannot be initialised because it is defined externally. 03/07/2022 09:32:52 WARN The creation of mapping sets in the structure database skipped the following dataflows that are external references or have mapping sets previously created: ABS:ABS_C16_T04_SA(1.0.0), ... . 03/07/2022 09:32:52 NOTICE The transaction 7123 to create all mapping sets in the structure database for all dataflows has completed.
- Make the outcome also available with the status requests
curl -X POST "https://transfer-qa.siscc.org/1.2/status/request" -H "accept: application/json" -H "Authorization: Bearer XXXXX" -H "Content-Type: multipart/form-data" -F "dataspace=qa:stable" -F "id=7123"
{ "sourceDataspace": null, "destinationDataspace": "qa:stable", "requestId": 7123, "userEmail": "jensXXXXX", "artefact": "N/A", "sourceData": null, "submissionTime": "2022-03-07T09:25:44.233", "executionStart": "2022-03-07T09:25:44.32", "executionEnd": "2022-03-07T09:32:52.4", "executionStatus": "Completed", "outcome": "Warning", "logs": [ { "transactionId": 7123, "userEmail": null, "date": "2022-03-07T09:25:44.233", "level": "NOTICE", "server": "transfer-566cc766d4-n4lws", "logger": "DotStatServices.Transfer.Controllers.DataManagementController.CreateAllMappingsets", "message": "The request with ID 7123 was successfully registered.", "exception": "" }, { "transactionId": 7123, "userEmail": null, "date": "2022-03-07T09:27:56.8", "level": "WARN", "server": "transfer-566cc766d4-n4lws", "logger": "DotStat.Db.Repository.SqlServer.SqlTransactionRepository.InitializeAllMappingSets", "message": "The dataflow ILO:DF_SDG_A871_SEX_AGE_RT(1.0) cannot be initialised because it is defined externally.", "exception": "" }, { "transactionId": 7123, "userEmail": null, "date": "2022-03-07T09:32:52.397", "level": "WARN", "server": "transfer-566cc766d4-n4lws", "logger": "DotStat.Db.Repository.SqlServer.SqlTransactionRepository.InitializeAllMappingSets", "message": "The creation of mapping sets in the structure database skipped the following dataflows that are external references or have mapping sets previously created: ABS:ABS_C16_T04_SA(1.0.0), ... .", "exception": "" }, { "transactionId": 7123, "userEmail": null, "date": "2022-03-07T09:32:52.407", "level": "NOTICE", "server": "transfer-566cc766d4-n4lws", "logger": "DotStatServices.Transfer.Controllers.DataManagementController+<>c__DisplayClass13_0`1+ <<CreateAllMappingsets>b__0>d.MoveNext", "message": "The transaction 7123 to create all mapping sets in the structure database for all dataflows has completed.", "exception": "" } ] }
Important note
Since this change is not backward compatible, we need to change the major transfer service version: Previous V1.2 should become V2.0.
Original issue with "TimedOutAborted" error in `init/allMappingsets`
Running https://transfer-qa.siscc.org/1.2/init/allMappingsets resulted in:
{
"sourceDataspace": null,
"destinationDataspace": "qa:stable",
"requestId": 6494,
"userEmail": "jensXXXX",
"artefact": "N/A",
"sourceData": null,
"submissionTime": "2022-03-03T16:48:53.337",
"executionStart": "2022-03-03T16:48:53.52",
"executionEnd": null,
"executionStatus": "TimedOutAborted",
"outcome": "Error",
"logs": [
{
"transactionId": 6494,
"userEmail": null,
"date": "2022-03-03T16:48:53.337",
"level": "NOTICE",
"server": "transfer-566cc766d4-n4lws",
"logger": "DotStatServices.Transfer.Controllers.DataManagementController.CreateAllMappingsets",
"message": "The request with ID 6494 was successfully registered.",
"exception": ""
},
{
"transactionId": 6494,
"userEmail": null,
"date": "2022-03-03T16:50:21.317",
"level": "WARN",
"server": "transfer-566cc766d4-n4lws",
"logger": "DotStat.Db.Repository.SqlServer.SqlTransactionRepository.InitializeAllMappingSets",
"message": "The dataflow ILO:DF_SDG_A871_SEX_AGE_RT(1.0) cannot be initialised because it is defined externally.",
"exception": ""
}
]
}
As a consequence, it seems that some data-db objects have not been updated in qa:stable, and requests like https://nsi-qa-stable.siscc.org/rest/data/UNSD,DF_JENS_DAILY,1.0/D..............?startPeriod=2015-01-01&endPeriod=2020-02-02&dimensionAtObservation=AllDimensions with Accept=application/vnd.sdmx.data+json;version=2.0;urn=true
result in HTTP 500 "Internal Server Error": "Error executing generated SQL and populating SDMX model".
When manually running https://transfer-qa.siscc.org/1.2/init/dataflow for the failing dataflow, then this SQL issue disappears for that dataflow.