How to handle exceptions thrown in Isolates? - multithreading

I'm experimenting with Dart and using the new streamSpawnFunction to create a new isolate.
I'm running my code in Dartium but i've noticed that if some kind of unrecoverable error occurs in the isolate i get no error message on the console. Because breakpoints in Isolate code are not working debugging is really painful.
The old Port based Isolate spawn function (spawnFunction) has a callback function for handling errors. I wonder why this is not available with streamSpawnFunction. Is there a new way to subscribe to the error events of an Isolate?

The missing functionality of streamSpawnFunction is just an oversight. I filed http://dartbug.com/9208 and I will try to fix it next week.
I'm not sure if it is a known problem that breakpoints don't work in isolates. I will let you file a bug-report (http://dartbug.com) so the devs can ask you questions and you are kept informed on the process.

Related

What is Comunication Failure in Shopware 5?

when creating new theme there's error occurred.
0 - Communication Failure
Why this happen? could you please help me?
This usually happens due to a timeout that occurs when the Theme-controller tries to read the Theme's configuration for the first time. Unfortunately, this is quite a resource-heavy process; on weaker servers, timeouts may occur during this process quite often.
You can confirm this by opening the Theme-Manager, opening your browser's developer tools, refreshing the Theme overview and look at the response of the backend/Themes/list-Request.
You can give your server more time with the php-function set_time_limit. In engine/Shopware/Components/Theme/Installer.php, in the synchronize-method, prepend set_time_limit(0):
public function synchronize()
{
set_time_limit(0);
$this->synchronizeThemes();
}
Alternatively, prepend set_time_limit(0); to your shopware.php file, but don't forget to remove it again once the theme-overview loaded successfully.

How to ignore specific errors from the New Relic Dashboard

Helllo,
My application is a web server that fires many requests to other servers. We set up a maximum timeout on those requests, and whenever the timeout is reached, the connection is closed and a ESOCKETTIMEDOUT rises.
Error: socket hang up
at createHangUpError (http.js:1472:15)
at Socket.socketCloseListener (http.js:1522:23)
at Socket.EventEmitter.emit (events.js:117:20)
at TCP.close (net.js:465:12)
I want to exclude these errors from the New Relic Dashboard, since they distort the error rate and other metrics. Hiding them doesn't work either, because they still count in the error rate.
How can remove specific errors (that do not have a HTTP status code) from my Dashboard?
You can pass status codes to ignore to the error collector. If you are configuring the New Relic agent using environment variables you can use a comma separated list of codes as the value for NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES.
See the README.
If you are using newrelic.js to do so you can set the error_collector.ignore_codes value to an Array of status codes to ignore:
See the example config.
Important caveat: when setting this value manually you are overriding the default value of 404 which means that if you do not specify 404 in your manual configuration the Error Collector will start logging all 404 errors in your application (which you probably do not want).
I noticed you have javascript, I'm not sure if my solution can help you but I'll answer in the hope it does.
I use Java agent, and we have the same kind of problem. So far the only way that I found that can do something near what I want is having the specific errors wrapped in a dedicated exception ("NewRelicIgnorableException") and wrap whatever error I don't want to see in it.
Then I'd have to go into the dashboard/application and select "error collection". Last, I'd fill in the "Ignore these errors" with the full package name AND exception class name, like com.mypackage.NewRelicIgnorableException. Save and enjoy. These particular errors should not impact your apdex, but they will still count towards RPM and other metrics.
Other solutions have drawbacks. For example if I call ignoreexception the RPM and time metrics will not count. If you click the "hide error" button you only hide them from the error panel, but everything else will be as usual. If you ignore by status code you can get more or less the same results as ignoring the specific exception, but without any hope for fine control.
It's a pity that there's so little documentation on their site, I had to run tests to find these out.

Socket.IO server hangs up

I am new to socket.io. So my socket.io server sometimws crashes giving this below error
timers.js:103
if (!process.listeners('uncaughtException').length) throw e;
^
Error: socket hang up
at createHangUpError (http.js:1360:15)
at ServerResponse.OutgoingMessage._writeRaw (http.js:507:26)
at ServerResponse.OutgoingMessage._send (http.js:476:15)
at ServerResponse.OutgoingMessage.write (http.js:749:16)
at XHRPolling.doWrite (E:\sitesroot\0\node_modules\socket.io\lib\transports\
xhr-polling.js:67:17)
at XHRPolling.HTTPPolling.write (E:\sitesroot\0\node_modules\socket.io\lib\t
ransports\http-polling.js:132:8)
at XHRPolling.Transport.packet (E:\sitesroot\0\node_modules\socket.io\lib\tr
ansport.js:515:15)
at Object.<anonymous> (E:\sitesroot\0\node_modules\socket.io\lib\transports\
http-polling.js:79:12)
at Timer.list.ontimeout (timers.js:101:19)
It doesnt show where or why the error is happening so pretty sure its nothing to do with the code i have written. Could be something with the transports? I dont have much knowledge on it. Any suggestions on how to stop it from crashing would be highly appreciated. Thanks
The problem is as #miktam stated.
To fix this you need to add an error listener to your code.
Add this code to your application:
//Error handler
process.on('uncaughtException', function (exception) {
// handle or ignore error
console.log(exception);
});
When ever there is an error it will console.log it instead of crashing it. I had the exact same problem and this fixed it.
Check this issue
Quoting Isaac Schlueter:
The good news is that you're no longer leaking memory. The bad news is
that you do indeed need to add error listeners to your objects.
In most apps, you can usually treat ECONNRESET as roughly the same as
a graceful close. Just make sure that you actually stop using that
socket, since it's now closed. However, it's not a graceful close,
since it's not in any sense "graceful". Prior to v0.8.20, node would
happily buffer all writes to reset sockets, causing memory explosion
death.
For us new to websocket, you might be missing some parameters that are required by socket.io library.
What you might be using is ws://localhost which works for Websocket library, but might need to use ws://localhost:3000/socket.io/?EIO=4&transport=websocket when using socket.io

libspotify: logging out or releasing session causes crash

This is in response to dan's (dan^spotify on IRC) offer to take a look at my testcase, but I post it here in case anyone has encountered similar issues.
I'm experiencing a problem with libspotify where the application crashes (memory access violation) in both of these two scenarios:
the first sp_session_process_events (triggered by notify main thread callback) that's called after the sp_session_logout() function is called crashes the application
skipping logout and calling sp_session_release() crashes the application
I've applied sufficient synchronization from the session callbacks, and I'm otherwise operating on a single thread.
I've made a small testcase that does the following:
Creates session
Logs in
Waits 10 seconds
Attempts to logout, upon which it crashes (when calling sp_session_process_events())
If it were successful in logging out (which it isn't), would call sp_session_release()
I made a Gist for the testcase. It can be found here: https://gist.github.com/4496396
The test case is made using Qt (which is what I'm using for my project), so you'd need Qt 5 to compile it. I've also only written it with Windows and Linux in mind (don't have Mac). Assuming you have Qt 5 and Qt Creator installed, the instructions are as follows:
Download the gist
Copy the libspotify folder into the same folder as the .pro file
Copy your appkey.c file into the same folder
Edit main.cpp to login with your username and password
Edit line 38-39 in sessiontest.cpp and set the cache and settings path to your liking
Open up the .pro file and run from Qt Creator
I'd be very grateful if someone could tell me what I'm doing wrong, as I've spent so many hours trying anything I could think of or just staring at it, and I fear I've gone blind to my own mistakes by now.
I've tested it on both Windows 7 and Linux Ubuntu 12.10, and I've found some difference in behavior:
On Windows, the testcase crashes invariably regardless of settings and cache paths.
On Linux, if setting settings and cache to "" (empty string), logging out and releasing the session works fine.
On Linux, if paths are anything else, the first run (when folder does not already exist) logs out and releases session as it should, but on the next run (when folder already exists), it crashes in the exact same way as it does on Windows.
Also, I can report that sp_session_flush_caches() does not cause a crash.
EDIT: Also, hugo___ on IRC was kind enough to test it on OSX for me. He reported no crashes despite running the application several times in a row.
While you very well may be looking at a bug in libspotify, I'd like to point out a possibly redundant call to sp_session_process_events(), from what I gathered from looking at your code.
void SessionTest::processSpotifyEvents()
{
if (m_session == 0)
{
qDebug() << "Process: No session.";
return;
}
int interval = 0;
sp_session_process_events(m_session, &interval);
qDebug() << interval;
m_timerId = startTimer(interval);
}
It seems this code will pickup the interval value and start a timer on that to trigger a subsequent call to event(). However, this code will also call startTimer when interval is 0, which is strictly not necessary, or rather means that the app can go about doing other stuff until it gets a notify_main_thread callback. The docs on startTimer says "If interval is 0, then the timer event occurs once every time there are no more window system events to process.". I'm not sure what that means exactly but it seems like it can produce at least one redundant call to sp_session_process_events().
http://qt-project.org/doc/qt-4.8/qobject.html#startTimer
I notice that you will get a crash on sp_session_release if you have a track playing when you call it.
I have been chasing this issue today. Login/logout works just fine on Mac, but the issue was 100% repeatable as you described on Windows.
By registering empty callbacks for offline_status_updated and credentials_blob_updated, the crash went away. That was a pretty unsatisfying fix, and I wonder if any libspotify developers want to comment on it.
Callbacks registered in my app are:
logged_in
logged_out
notify_main_thread
log_message
offline_status_updated
credentials_blob_updated
I should explicitly point out that I did not try this on the code you supplied. It would be interesting to know if adding those two extra callbacks works for you. Note that the functions I supply do absolutely nothing. They just have to be there and be registered when you create the session.
Adding the following call in your "logged in" libspotify callback seems to fix this crash as detailed in this SO post:
sp_session_playlistcontainer(session);

Trappable error 0xC0000005

We have one very old legacy application written on Classic ASP. Recently on a couple of servers we've started to get fatal errors. IIS process crashes. We've got few error's stack traces with IIS Debug Tool. There is 2 common types of errors.
We are using only few types of COM components in our application: ADO, Scripting.Dictionary, Scripting.FileSystem & MSXML6.
IIS logs says that error description is access violation exception (0xC0000005).
Do you have any ideas about the reason of errors or any ways for future debugging. Any ways to get more info about this errors will be very appreciated.
Thanks.
Stack traces:
1.
1996e18
oleaut32!VariantCopy+173
oleaut32!SafeArrayCopyData+14e
oleaut32!SafeArrayCopy+e3
oleaut32!VariantCopy+5b
oleaut32!VariantCopyInd+1a1
asp!CComponentObject::GetVariant+27
asp!CApplnVariants::get_Item+da
oleaut32!DispCallFunc+16a
oleaut32!CTypeInfo2::Invoke+234
asp!CDispatchImpl<IVariantDictionary>::Invoke+55
oleaut32!CTypeInfo2::Invoke+58a
asp!CDispatchImpl<IApplicationObject>::Invoke+55
vbscript!IDispatchInvoke2+b2
vbscript!IDispatchInvoke+59
vbscript!InvokeDispatch+13a
vbscript!InvokeByName+42
vbscript!CScriptRuntime::RunNoEH+22b2
vbscript!CScriptRuntime::Run+62
vbscript!CScriptEntryPoint::Call+51
vbscript!CSession::Execute+c8
vbscript!COleScript::ExecutePendingScripts+144
vbscript!COleScript::SetScriptState+14d
asp!CActiveScriptEngine::TryCall+19
asp!CActiveScriptEngine::Call+31
asp!CallScriptFunctionOfEngine+5b
asp!ExecuteRequest+17e
asp!Execute+24c
asp!CHitObj::ExecuteChildRequest+12c
asp!CErrInfo::LogCustomErrortoBrowser+28a
asp!CErrInfo::LogErrortoBrowserWrapper+8b
asp!CErrInfo::LogError+77
asp!HandleError+100
asp!HandleErrorMissingFilename+ac
asp!CActiveScriptEngine::Call+a7
asp!CallScriptFunctionOfEngine+5b
asp!ExecuteRequest+17e
asp!Execute+24c
asp!CHitObj::ViperAsyncCallback+3f0
asp!CViperAsyncRequest::OnCall+92
comsvcs!CSTAActivityWork::STAActivityWorkHelper+32
ole32!EnterForCallback+c4
ole32!SwitchForCallback+1a3
ole32!PerformCallback+54
ole32!CObjectContext::InternalContextCallback+159
ole32!CObjectContext::DoCallback+1c
comsvcs!CSTAActivityWork::DoWork+12d
comsvcs!CSTAThread::DoWork+18
comsvcs!CSTAThread::ProcessQueueWork+37
comsvcs!CSTAThread::WorkerLoop+190
msvcrt!_endthreadex+a3
kernel32!BaseThreadStart+34
2.
scrrun!FreeList+f   
scrrun!VBADictionary::~VBADictionary+28   
scrrun!VBADictionary::`scalar deleting destructor'+d   
scrrun!VBADictionary::Release+17   
oleaut32!VariantClear+b1   
oleaut32!ReleaseResources+98   
oleaut32!_SafeArrayDestroyData+4d   
oleaut32!_SafeArrayDestroy+b3   
oleaut32!SafeArrayDestroy+f   
oleaut32!VariantClear+75   
vbscript!VAR::Clear+a6   
vbscript!CScriptRuntime::Cleanup+63   
vbscript!CScriptRuntime::Run+8d  
vbscript!CScriptEntryPoint::Call+51  
vbscript!CScriptRuntime::RunNoEH+1e02 
vbscript!CScriptRuntime::Run+62  
vbscript!CScriptEntryPoint::Call+51   
vbscript!CScriptRuntime::RunNoEH+1e02  
vbscript!CScriptRuntime::Run+62   
vbscript!CScriptEntryPoint::Call+51   
vbscript!CScriptRuntime::RunNoEH+1e02   
vbscript!CScriptRuntime::Run+62   
vbscript!CScriptEntryPoint::Call+51   
vbscript!CScriptRuntime::RunNoEH+1e02   
vbscript!CScriptRuntime::Run+62   
vbscript!CScriptEntryPoint::Call+51   
vbscript!CSession::Execute+c8  
vbscript!COleScript::ExecutePendingScripts+144  
vbscript!COleScript::SetScriptState+14d  
asp!CActiveScriptEngine::TryCall+19   
asp!CActiveScriptEngine::Call+31   
asp!CallScriptFunctionOfEngine+5b   
asp!ExecuteRequest+17e  
asp!Execute+24c   
asp!CHitObj::ViperAsyncCallback+3f0   
asp!CViperAsyncRequest::OnCall+92   
comsvcs!CSTAActivityWork::STAActivityWorkHelper+32   
ole32!EnterForCallback+c4   
ole32!SwitchForCallback+1a3   
ole32!PerformCallback+54   
ole32!CObjectContext::InternalContextCallback+159   
ole32!CObjectContext::DoCallback+1c   
comsvcs!CSTAActivityWork::DoWork+12d   
comsvcs!CSTAThread::DoWork+18   
comsvcs!CSTAThread::ProcessQueueWork+37   
comsvcs!CSTAThread::WorkerLoop+190   
msvcrt!_endthreadex+a3
kernel32!BaseThreadStart+34
We had very similar situation last couple weeks. It was very complicated to track down this issue. The problem is in OnError handler of VB6 code. There are 2 cases to reproduce:
you do not have OnError handler, error occurs and goes directly to
IIS
error occurs in OnError handler and goes directly to IIS.
After ~100 such errors IIS will fail to work normally. It will be absolutely unpredictable behavior after this moment.

Resources