1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Unity 5.6 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Unity 4.0.1f2 and avast 8.0.1482 = "getThreadContextfailed" error

Discussion in 'Editor & General Support' started by Spi, Mar 4, 2013.

  1. Spi

    Spi

    Joined:
    Oct 4, 2011
    Posts:
    16
    Hi,

    Since I upgraded avast to v.8, my unity projects crash randomly with the following error :

    Fatal error in CG : "getThreadContextfailed"

    The problem is that even the build version crash. How can I fix it ? Without uninstalling any antivirus of course.
     
  2. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    Happening for me too. Same combination of tools. Ever since I upgraded Avast. Only happens in Unity.
    Very annoying. I tried adding the Unity Program folder to my Global Exclusions. This is listed as having worked for other anti virus programs. It is still happening for me. There might be another setting that needs to be changed.
     
    Last edited: Mar 5, 2013
  3. RGravity

    RGravity

    Joined:
    Jul 4, 2012
    Posts:
    29
    Yep, same here - this is a very annoying bug and has caused me to lose work several times now.
    I tried adding unity folder + the folder of the project I'm working on, I don't want to uninstall Avast but looks like I might have to if I can't find a workaround.
     
  4. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    Hey guys,

    Please file a bug to us and I'll take a look.

    Thanks,
    Chris
     
  5. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    The Bug thingy wants me to upload my 1GB project, which I've been avoiding so far.
    I'll make something more compact and see if I can make it happen in a reasonable manner.
    Until then, I tried the same thing as RGravity, and it still crashes. Even added the project folder that I'm working on to exclusions to give that a shot.
     
  6. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    Report submitted with a very tiny bit of code.
     
  7. RGravity

    RGravity

    Joined:
    Jul 4, 2012
    Posts:
    29
    Yeah this one is nasty - now it crashes *a lot*
    Thanks for submitting akeplinger, hopefully it won't be too long for a fix.
     
  8. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    Can't work in Unity. THinking that I need to uninstall avast until it's fixed.
     
  9. Spi

    Spi

    Joined:
    Oct 4, 2011
    Posts:
    16
    Uninstalling Avast fix it (whitelisting apps or disabling agents doesn't) . But the problem is that even the windows builds of our applications crash with the same error. It is really problematic for our users.
    When I was googling the error, I saw that Unity has already had this issue with other antivirus like Kaspersky or ESET (nod32).
    I hope this issue will be fix soon and that there are no other issues with any antivirus in general. I can't tell the users : if you want to use my game/application, uninstall any antivirus on your computer or install just this one because for now it works.
    This is a major issue in my opinion and like RGravity said, hopefully the Unity great team will take this problem seriously and find a solution asap.
    Thank you CreativeChris to keep us informed on this fix and possibly on the origin of the problem (network, yield, multi-threaded, loading code...)
    Best Regards
     
  10. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    Same problem here - yesterday I've updated Avast and now I have this error in random places (even in the build). I cannot even replicate it - it pops wherever it wants.

    I guess it's the same bug that was with ESET or Kaspersky.
     
  11. spanik

    spanik

    Joined:
    Mar 6, 2013
    Posts:
    1
    Same situation for me. Updated Avast to version 8.0.1482, and now working with Unity version 4.0.0f7 has become this terrible game: I could "die" any time...

    I tried setting file path exclusions + restarting the computer, without success. I certainly won't uninstall Avast! for this! so what to do?
     
  12. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    I went back to Unity 3.5.7 just to check, if problem exists with the older version - and it is there too.

    Like Spis said, we cannot tell the users to uninstall antyvirus - so there is two ways: Unity will have to fix/change something, or Avast.
     
  13. Shirown

    Shirown

    Joined:
    Mar 7, 2013
    Posts:
    3
    Hello,

    Disable Avast agents for 10 min allowed me to run Unity correctly when I launch the game test. (No "GetThreadContextfailed")
    After 10 min, the agents Avast restarts. Unity does not encounter problems at this time.

    No need to uninstall avast to continue to develop, but there really is a conflict with Avast agents (?).
    I have not been able to test with a build if avast conflicted.

    Yes, a fix would be welcome, thank you to the Unity team and good luck.

    Sorry for my english, I'm french.

    see you.
     
  14. RGravity

    RGravity

    Joined:
    Jul 4, 2012
    Posts:
    29
    I posted in another thread that I had an update from Avast for Google Chrome - and after I installed it the problem hasn't happened since, it could be a coincidence but I don't think so as it was happening very frequently before.
     
  15. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    Hey all,

    Just to let you know, we received the bug submitted by @akeplinger I believe, and this will be investigated ASAP.

    I'll hopefully be able to update you guys here also ASAP.

    Thanks,
    Chris
     
  16. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    I've tried disabling Avast agents like Shirown said, but it didn't help at all. I also have added Unity folder to the exceptions in Avast - it doesn't solve the problem, but frequency of error is smaller (weird).

    I can say, that this error happens on 64-bit operating systems. Those in my team that have 32-bit Windows 7 don't have this error (version of Avast is everywhere the same). Can someone else confirm this?
     
  17. Shirown

    Shirown

    Joined:
    Mar 7, 2013
    Posts:
    3
    Some information that may help to understand the differences in bug (?)

    Unity3D => Version 4.0.0f7
    Avast Free =>Version 8.0.1482 - Version BDD 130307-0
    Win7 Pro 64Bit SP1

    The bug is still not reappeared since. So I can not send report now. sorry.

    But I also think a coincidence about the bug and agents Avast
     
  18. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,215
  19. RGravity

    RGravity

    Joined:
    Jul 4, 2012
    Posts:
    29
    Yeah I spoke too soon too, just got the error again, not doing anything special with either Unity or Avast, just working as usual - what the hell is causing this?
     
  20. TIGGYsmalls

    TIGGYsmalls

    Joined:
    Jan 10, 2013
    Posts:
    38
    Same problem here. New Avast seems to crash Unity randomly.

    I just put the Program Files AND the Documents Folder into global exclusions and it hasn't crashed since. Although, this could be due to the randomness of the crashes.
     
  21. TIGGYsmalls

    TIGGYsmalls

    Joined:
    Jan 10, 2013
    Posts:
    38
    No... It's still crashing.
     
  22. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    3,511
    Antivirus is supposed to be unobtrusive, and not affect other programs. Have you tried contacting Avast?
     
  23. Harry64

    Harry64

    Joined:
    Jan 21, 2013
    Posts:
    18
    same problem. the last time Unity worked as normally was like 2 weeks ago. the only big change on my pc was the big Avast Antivir update.
    now It crashes like every 10 minutes. I mostly play around with physics. (rigidbodys, hinges, bones,)

    my System:

    Windows 7 Professional Service Pack 1
    8 GB RAM
    64 Bit
    Intel Core 2 Quad Q9550 2.83GHz
    AMD Radeon HD 7900

    Avast! Antivir 8.0.1482
    Outpost Firewall Pro 7.1
    Spybot - Search Destroy 1.6.2.0
     
  24. VirtualSUN

    VirtualSUN

    Joined:
    Jan 29, 2013
    Posts:
    4
    Same thing!
    Avast
    Update
    8
    Unity crashed every 5-20 minuts. :'(

    "getThreadContext failed"

    Avast 8.0.1483
    Unity 4.0.1f2
     
    Last edited: Mar 8, 2013
  25. UnityDigger

    UnityDigger

    Joined:
    Nov 20, 2011
    Posts:
    79
    AFAIK, this is not a Unity3D bug.
    It comes from mono runtime and antiviral provokes situation during mono's GC, when some thread somehow starts on "stopped world".
    And Unity3D still use very old version of mono.


    to Unity3D crew some info:

    looking inside win32_threads.c

    if new tread starts in same time as other thread call GC_stop_world, then this thread may invoke GC_new_thread BEFORE GC_push_all_stacks that first thread will call. So new thread pushed into GC-thread-list, but it is NOT suspended. So we have "GetThreadContext failed" on this alive thread inside stopped world.

    You may update boehm-gc to fresh version and rebuild mono.

    If you want more info, contact me.
     
  26. RGravity

    RGravity

    Joined:
    Jul 4, 2012
    Posts:
    29
    I never thought it was a Unity issue, more that Avast was interfering in some Mono process and screwing it up.
    I've uninstalled Avast and installed Microsoft Security Essentials instead, the problem is no longer happening for now so hopefully it's gone for good as it's incredibly disruptive.
     
  27. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    Hi guys,

    As promised here's an update on the issue, from investigating the bug submitted by @akeplinger I believe, which included a small repro project we couldn't reproduce the GetThreadContextFailed error with the latest Avast version.

    Some details that are missing which could help us repro, what type of actions in the editor are you doing to see it? If you're on windows you could run Problem Step Recorder, this details a list of actions you've taken in lead up to the error appearing. We tried a number of random actions but couldn't get it to output that error.

    So, please, we need more details.

    Thanks,
    Chris
     
  28. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    Hi guys,

    Another update, we discovered that this error occurs when updating from Avast 7 to Avast 8, as when we directly install Avast 8 we couldn't reproduce it. Having installed Avast 7 then doing the update to version 8 we started seeing the error occur when in play mode in the editor.

    So, as a workaround for now, you could directly uninstall all Avast products, restart your machine and then directly install Avast 8, in theory from what we have seen; this should fix it for now but we can't promise that.

    Additional info, the bug report has now been assigned to the developer, he is working on fixing errors like this and should be fixed for a future 4.x version, no guarantees yet unfortunately on what version will fix it. Mono bugs are very risky in fixing, we have to do thorough testing and implementation before we can ship to ensure we don't break any existing content which takes time.

    Please bare with us and hope this helps,

    Over and out!

    Thanks,
    Chris
     
  29. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    I'll make a clean installation of Avast and see if it helps - thank you for all information that can be useful to avoid this error :)

    As I wrote before, this bug appears only in 64-bit systems (as far as I can tell) and it's showing in random places - sometimes in play mode in the editor (just like you said), sometimes when Unity is just open and nothing happens and sometimes in the build (without Unity being open, so it can happen even to common user).

    I hope this error will be fixed permanently as soon as it is possible :)
     
  30. TIGGYsmalls

    TIGGYsmalls

    Joined:
    Jan 10, 2013
    Posts:
    38
    Well, I have been using Unity for 2 hours now with no crashes after following the advice.

    :)
     
  31. Shirown

    Shirown

    Joined:
    Mar 7, 2013
    Posts:
    3
    Thanks Chris ^^

    Good day.
     
  32. Uniter

    Uniter

    Joined:
    Apr 9, 2010
    Posts:
    17
    This bug "GetThreadContext failed" occurs not only in Unity editor (what is headache for developers) but in compiled program even more often. I have Kaspersky antivir, not Avast and get the same problem in compiled application (Metal War Online game, www.mwogame.com). I don't have Unity3d editor on this computer at all. And still have crashes. And on other computer I even don't have Kaspersky (there are MS Essintials antivir) and still have this crashes also. Most typical situation when this takes place is switching to zoom mode. I think it is needed more RAM for that and GC starts working more intensively. Both PCs have Win7 and 4 GB of RAM. Hope this helps.
     
  33. VirtualSUN

    VirtualSUN

    Joined:
    Jan 29, 2013
    Posts:
    4
    Last edited: Mar 9, 2013
  34. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    Yup, I can confirm - even after clear installation of new Avast it's still crashing - sometimes couple of seconds/minutes after starting Unity and sometimes after couple of hours of continuous work.

    If this problem was only in the editor, than I would probably just ignore it, uninstall Avast and keep working - but it appears also in-game...
     
  35. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    Avast needs to fix this. Unity3D can patch, but this change in Avast will break existing, delivered projects. All of the developers cannot be expected to update their apps. Avast is causing this break. Will try installing Avast 8 now as this appears to be a good solution.
     
  36. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    Did a fresh install of Avast and error happened after about 2 hours. So, not fixed. Just uninstalled Avast again so I can keep working. Going to switch to Norton, but this needs to be fixed, preferably by Avast. Somebody from Unity should contact them.
     
  37. Harry64

    Harry64

    Joined:
    Jan 21, 2013
    Posts:
    18
    have also deinstalled avast and installed avast internet security 8 directly and hoped the error is gone but now I was just setting the rotation of a simple block with texture and then unity crashes again......... I cannot work with this. is there a way to contact avast so that they can fix avast so unity wont crash?
     
  38. Kaze_Senshi

    Kaze_Senshi

    Joined:
    Feb 19, 2012
    Posts:
    243
    Same problem here, the error occurred in the Scene Editor, during the gameplay of a compiled game or even when the Unity editor was minimized, in this case there was a looot of "GC error" popups when I came back to the Unity window.
     
  39. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    That sucks the workaround hasn't worked for you guys, sorry about this, we do know this is very frustrating for you all. I don't have any other workarounds for you except for the sucky one which is to switch to another AV temporarily.

    I'm going to submit a support ticket to Avast, I suggest everyone here does the same, hopefully they will see that Avast 8 is causing problems for a lot of people.

    Found this link to submit a ticket:

    http://support.avast.com/index.php?languageid=1&group=eng_m=tickets_a=submit

    Cheers,
    Chris
     
  40. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    Submitted - thank you Chris for your help :)
     
  41. UnityDigger

    UnityDigger

    Joined:
    Nov 20, 2011
    Posts:
    79
    AGAIN, this is NOT Avast bug. Trouble is in win32 part of old version of boehm-gc inside mono core. Thread-safety issue.
    Any random thing may produce this error. Sometimes when Kaspersky/Avast/Nod32/Etc have some activity. Sometimes even when you minimize your game to taskbar.

    Yes, and this is HEADACHE for many-many players worldwide. Just try to google "GetThreadContext failed" and look what engine these games uses.

    You may write tickets to each of antiviral product, but this is wrong way.

    Disabling antiviral tool reduce chance of error, but does not solve at all.

    Please, read again my post above.
     
    Last edited: Mar 11, 2013
  42. VirtualSUN

    VirtualSUN

    Joined:
    Jan 29, 2013
    Posts:
    4
    I sent my report. 368Mb. I hope it help.

    It's killing me. In a future I want buy your product. Fix this problem please.
     
  43. Spi

    Spi

    Joined:
    Oct 4, 2011
    Posts:
    16
    I have just receive a feedback from Avast Tech support. They don't seem to be doing anything about this problem. Just telling me how to deal with AV exclusion and we already tried this option without success (I will try again soon)... Here is the solution he gave me :


    I completly agree with UnityDigger ! This is a really annoying problem not only for us, developpers, but also for every Unity based game players.
    Please, fix this bug to help unity games be more compatible. We can't ask our gamers to uninstall their AV just to be able to play a game or to use our 3D application. This wouldn't be professional.
     
    Last edited: Mar 12, 2013
  44. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    Thanks for your additional comments, I must add that I've already told you how this issue is being handled by us, I'll quote it here for you:

    I'll also reiterate that I know it's frustrating for you guys, but we are doing everything we can to ensure a fix is coming that actually works and doesn't break other stuff. Watch this space for more info.

    Thanks,
    Chris
     
  45. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    141
    Hello All,

    Just wanted to let you know that I am looking at getting this fixed, although with the changes needed and the area of code affected (the GC) I am not sure how soon it will happen.

    @UnityDigger I have looked at the mentioned change before and am testing it locally. It will probably help in some cases and I'll update our local libgc to use it. That being said, the one change alone has not been enough to alleviate the problem in the past. I am making some larger changes in how the GC manages threads on Windows which are being tested as I write this.

    Thanks,
    Jonathan
     
  46. Spi

    Spi

    Joined:
    Oct 4, 2011
    Posts:
    16
    Thank you Chris and Joncham for taking this issue seriously !
    Let's wait for good news !
    Best Regards,
    Spi
     
  47. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    33
    Trying Avast again, for the third time. I never had this error before Avast upgraded to 8.0 and now it's about every 15 minutes. If this doesn't work I'll have to look into rolling back to the older version of Avast.
     
  48. UnityDigger

    UnityDigger

    Joined:
    Nov 20, 2011
    Posts:
    79
    +1
     
  49. Kwikalot

    Kwikalot

    Joined:
    Mar 6, 2013
    Posts:
    13
    Ok, I'll take your word for it, because this is not my area of expertise :)

    However I think that solution to this problem lies on both sides - Unity and Avast. If Unity team will fix the problem, it will only affect new games, but titles that are using older versions (for example 3.5.7) will still have this issue.

    As I mentioned before, I tested new Avast with Unity 3.5.7 and the problem still exists. So I think, that there must be something new in Avast 8, that is provoking this error. Ok, I know that you said that any random thing may produce this error, but the fact is that after releasing new version of Avast, the frequency of this bug had gone up (or, in my case, it appeared for the first time ever).

    So ok, Unity team have to fix this on their side, but for the sake of the older games I think Avast should also look into it.
     
  50. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    364
    @Kwikalot, the fix should be backwards compatible for released games on the WebPlayer at least, if there are standalone games that were built with earlier version, then it's case of updating their project and re-publishing them under the new version which contains the fix. When do you actually see the error? is it in the editor? playing a WebPlayer or standalone game? (just curious).

    The fix @jonchamb has made has been running overnight in the editor, I should know more later regarding if the fix actually worked or not. Stay tuned.

    Thanks,
    Chris