Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by AlwaysSunny · Nov 01, 2016 at 10:29 PM · crashcrashingdebugging

Steps For Debugging Lockup Issue of Unknown Nature

Hi folks!

I'm in Month 32 of a solo project, and a lockup-inducing bug has been cropping up intermittently for about six months now. I thought I'd have found it by now, but the game is nearly complete and I'm no closer to identifying the cause.

The lockups aren't that difficult to duplicate, but I can't pin down precise conditions. I have discovered that they only occur after the game has been left paused for a while, OR after the application has switched out of focus for a while. But I can't always trigger the problem on purpose.

There's so much logic that might be responsible (even given these isolated criteria), I really cannot fathom how to approach finding the cause(s).

The first error reported is always that my "supervisor" singleton instance is nullified. Because so many classes call this expecting it to be non-null, knowing this doesn't tell me anything about why it's happening.

All subsequent errors seem related to this one, but in the same frame, it stops producing new errors and locks up, requiring me to terminate the process.

I'm very confident that there's no logic that should be capable of nullifying this instance, so I'm really at a loss for what's happening. I don't even know what to try first to find out. I'm also not sure it has anything to do with the root of the problem. In fact it seems more likely it's only a primary symptom.

Any advice? Really any at all might help. I'm unfamiliar with debugging "complete unknowns" in a complex project.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Nov 02, 2016 at 02:12 AM

This is nearly impossible to answer as there are way too many unknown variables involved. You haven't given any useful information about your project.

Some questions:

  • Do you use thread and locking anywhere in your project?

  • That singleton you talk about, how does it look like? Do you use a property or just a public static variable?

  • What kind of class is that singleton? A MonoBehaviour derived class or a normal class?

  • Do you use recursive method calls or endless loops somewhere? Even a coroutine can lock up your application when you don't reach any yield inside an infinite loop. Infinite loops can be hidden (i.e. the loop itself looks fine but something else changes a shared variable which leads to the infinite loop).

  • What kind of "pause" do you talk about? Do you mean the Pause button inside the editor? Or do you mean your own pause mechanics in-game (i.e. Time.timeScale)? What's "for a while" in terms of seconds / minutes / hours?

In case you use threading and this problem is related to threaded code you're officially screwed if you didn't program everything thread-safe.

In the other cases it's not that hard to figure out why or where your singleton is lost / destroyed. First if you just use a public static variable you should replace it with a public static property and use a private backing field. This allows you to log every get and set call of your singleton. You also make the singleton read-only that way.

In case you already use a property and your object is a MonoBehaviour derived class, you might want to add an additional null-check inside the getter and execute Debug.Break() if it's null. This should pause the editor right after this frame.

If it still locks up it has to be directly related to the null-value of your singleton. -

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AlwaysSunny · Nov 02, 2016 at 03:50 AM 0
Share

Thanks for the extended write-up! Sorry for the poor communication. I'll look into this advice. $$anonymous$$uch obliged for the help,

avatar image AlwaysSunny · Nov 03, 2016 at 05:06 AM 0
Share

Accepting, as this certainly qualifies as "steps for debugging". $$anonymous$$ight revisit the issue in a more refined question once I better grasp what's happening. Thanks again,

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

59 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity (5.5.0p3) debugger crashes when stepping through code (repro available) 2 Answers

mobile app crash 0 Answers

Crashing no error 0 Answers

Unity Crashes when opened 1 Answer

Built Game Crashes But Not On Editor 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges