0

I have WebAPI. It takes data from request and tries to create/update records in db. In result it should show what records is successfully created/update and which are partially successful (created/updated but not all data because of some reason that should be returned also).

Locally it works fine. But when I deployed it on test server, request not receiving any response. I am doing tests with Postman. It is always saying "Sending request...".

I've added everywhere try-catch block, logs etc. From logs I can say that everything is saved in db. None exception is catch.

What can be the reason of such behavior?


I run SQL Profiler to check if none deadlock happened. Result - no deadlock in db. Only strange thing - it is Window Full together with ZeroWindowProbe detected by Wireshark. But don't think it is a reason.


Schematic algo of API:

WebApi Action -> Command -> Command Handler -> TransactionScope -> work with incoming data -> save changes -> commit transaction -> return response.


After adding more logs - seems like issue with Action.

    [HttpPost]
    [Route("api/integration/post")]
    public async Task<IHttpActionResult> Upload([FromBody] IntegrationRequestBody body)
    {
        var users = body.Data.Select(d => d.ToObject<UserImportModel>()).ToList();
        var response = await this.IntegrateUser(body.Date, users).ConfigureAwait(false);

        this._logger.Error("Some response here");

        return response;
    }

At logs I see record "Some response here", but in Postman it is still "Sending request...". It isn't reproduced all time. But I don't know what is a cause of it.

demo
  • 6,038
  • 19
  • 75
  • 149
  • Can you show us minimum reproducible code ? Does it happen to all requests? Can you make one endpoint without DB ? is there some firewall ? – Pribina Sep 29 '22 at 13:52
  • @Pribina, minimum code - is very complicate to do. No, not for all request. Really it happens when it should add/update something in db. If nothing (there is some validation on backend), then response is returned. That's why I thought it is deadlock somewhere on db. – demo Sep 29 '22 at 14:22
  • considering it happens only in server some logs, or remote debugging ? – Pribina Sep 29 '22 at 14:49
  • logs - nothing special. I added my custom logs to all possible steps. Before and after any save operation in db and just before returning response. Every log was present, but response didn't come – demo Sep 29 '22 at 15:07
  • You need to identify which step is failing. Make static command(contains same data) instead of input from request. Is data present in DB? can you publish mock of db on server to get some static response? – Pribina Sep 29 '22 at 15:51
  • just add more logs - seems like issue in Action. I have a log just before returning response. But after - nothing – demo Sep 29 '22 at 15:52
  • what if you replace return response -> return "static response" if this works issue is response format. it could be issue of serialization. – Pribina Sep 30 '22 at 12:06
  • @Pribina, just tried to return `return this.Ok("Some response here");` (after all calculations) - request is stucked. I can try one more time, but it also may be stucked or not – demo Sep 30 '22 at 12:37
  • @Pribina, have tried without any calculation - everything is working. Also tested with Task.Delay(...) - delay for 5 mins. Now it is stucked. :/ – demo Sep 30 '22 at 12:55
  • seems like https://stackoverflow.com/questions/70817226/no-response-when-request-takes-5-minutes-or-longer related issue – demo Sep 30 '22 at 14:14

0 Answers0