I have a website (ASP.NET MVC) where I can upload two videos and Chrome extension that can call ASP.NET Web API. Both website and Web API running under IIS from Visual Studio start without debug option.
Now I uploaded two videos to my ASP.NET MVC website and extension got two URLs of uploaded videos. Extension is set to call same action from Web API controller using two AJAX calls for two videos separately. Both AJAX calls wrapped in setInterval
, one interval is 1000ms other is 2000ms.
Occasionally after 2-4 calls from ajax Web API crashes in IIS and at the same time in Chrome console I can see one error for net::ERR_CONNECTION_RESET
and then other errors net::ERR_CONNECTION_REFUSED
.
I've tried to debug web API and put my action code in try-catch
block but it didn't help and debug session crashes without any exception message or error with return code -1. I've also tried to search for similar questions but didn't find anything.
Ajax:
setInterval(function () {
$.ajax({
url: requestApiVideo1,
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: succFunc1,
error: errFunc
});
}, 1000);
setInterval(function () {
$.ajax({
url: requestApiVideo2,
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: succFunc2,
error: errFunc
});
}, 1000);
This is definitely not what I expected to see when I call Web API from simple ajax. I expect Web API to put concurrent ajax requests in queue at least.
Edit: This is what I found in Event Viewer:
Faulting application name: iisexpress.exe, version: 10.0.14358.1000, time stamp: 0x574fb9e6.
Faulting module name: ucrtbase.dll, version: 10.0.17134.619, time stamp: 0xf74cf274
Exception code: 0xc0000409
Fault offset: 0x000000000006ca78
Faulting process id: 0x31d8
Faulting application start time: 0x01d4ef27c034cf15
Faulting application path: C: \ Program Files \ IIS Express \ iisexpress.exe
Faulting module path: C: \ WINDOWS \ System32 \ ucrtbase.dll
Report Id: 76c3023e-f31b-412e-9c5c-07e9bb1180ba
Faulting package full name:
Faulting package-relative application ID:
UPDATE: My C# Web API action code calls methods from C++ dll.
I found a memory leak in my C++ dll module. I t was a write method that didn't properly free allocated memory:
extern "C" __declspec(dllexport)
int writeToFile(const char * file1, const char * file2, const char * id) {
WavFile* originalFile = wav_file_api().init(file1, READ, 1024);
WavFile* signedFile = wav_file_api().init(file2, WRITE, 1024);
int16_t buffer[1024];
size_t read_size;
char sign[17];
sprintf_s(sign, 16, "%s", id);
sign[16] = 0;
signedFile->header = originalFile->header;
fwrite(&(signedFile->header), sizeof(WavHeader), 1, signedFile->file);
while ((read_size = wav_file_api().read_next_chunk(originalFile, buffer))) {
apply_sign(buffer, sign);
wav_file_api().write_next_chunk(signedFile, buffer);
}
wav_file_api().del(signedFile);
wav_file_api().del(originalFile);
return 1;
}
User contributions licensed under CC BY-SA 3.0