Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by blitzprog · Oct 26, 2013 at 06:33 PM · destroyserverresourceslinuxheadless

Server crashes accessing the same asset on 2nd instance

I'm at my wit's end with this problem:

I have a server and a client. There are 2 maps, called "Nubek" and "Ruins". There are 3 "game modes" or server types called "Town", "Match" and "FFA". The server is running on Ubuntu 13.04 x64 with Linux headless mode x64. Starting the server twice with the same map leads to the following results:

Locally (Windows x64):

  • Town: Working

  • Match: Working

  • FFA: Working

Live server (Ubuntu 13.04 Linux headless mode x64):

  • Town: Working

  • Match: Working

  • FFA: Fail on 2nd instance start, logs stop at Resources.Load("Maps/Nubek")

Here's a screenshot on the live server starting the server with the same map twice:

2x Town works, 2x FFA fails

After this I thought "What are the differences?" and "Why is the instance crashing 1 second after the start?". So I checked the logs and they stop at Resources.Load("Maps/Nubek") on the second FFA instance. It's a single binary started multiple times on the linux server with the same data folder. This was normally never a problem. Any idea what might be causing it? Anyway, this was the main problem. But here comes something weirder:

One thing that I suspected to be the cause of the Resources.Load() crash was my "DestroyServerAssets" function which is called after map load on the first instance.

     // DO NOT CALL THIS IN THE EDITOR
     private void DestroyServerAssets() {
         LogManager.General.Log("Going to destroy unneeded server assets");
         
         // Remove all textures
         var allTextures = Resources.FindObjectsOfTypeAll(typeof(Texture));
         LogManager.General.Log(allTextures.Length.ToString() + " textures loaded, going to destroy.");
         foreach(var obj in allTextures) {
             Destroy(obj);
         }
         LogManager.General.Log("Textures destroyed.");
         
         // Remove all audio clips
         var allAudioClips = Resources.FindObjectsOfTypeAll(typeof(AudioClip));
         LogManager.General.Log(allAudioClips.Length.ToString() + " audio clips loaded, going to destroy.");
         foreach(var obj in allAudioClips) {
             Destroy(obj);
         }
         LogManager.General.Log("Audio clips destroyed.");
         
         // Remove all materials
         var allMaterials = Resources.FindObjectsOfTypeAll(typeof(Material));
         LogManager.General.Log(allMaterials.Length.ToString() + " materials loaded, going to destroy.");
         foreach(var obj in allMaterials) {
             Destroy(obj);
         }
         LogManager.General.Log("Materials destroyed.");
         
         // DO NOT DELETE THE MESHES, YOU WILL GET PROBLEMS ON THE SERVER
     }

Don't ask me why the first instance would interfere with the assets of the 2nd instance, it doesn't even make sense to me, but that was my first idea. So I tried commenting out the call to DestroyServerAssets() and checked it again. The result: Now if I start a 2nd instance with the same map, it's not the 2nd instance crashing anymore but rather the first instance that crashes. Now the crash happens on all game modes.

I am using Unitypark / uZone for the instance management, however I am 99% sure this is not related to any library problems because the call that fails is Resources.Load() in the first problem I described.

Does Destroy()'ing game objects in a running Unity instance cause any problems for a 2nd instance using the same assets? As far as I know Destroy() is not an "inter-instance" call and should only destroy the loaded asset in RAM only for the calling instance, or am I wrong? What's going on here?

Comment
Add comment · Show 2
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 meat5000 ♦ · Oct 26, 2013 at 06:36 PM 0
Share

You should avoid destroying assets and destroy instances ins$$anonymous$$d. If multiple objects are derived from the same asset, destroying the asset may cause problems to the instances.

Destroying an instance should not affect other instances.

As I understand it, Garbage collection should automatically free up the RA$$anonymous$$ previously taken by resources which are no longer referenced.

avatar image blitzprog · Oct 26, 2013 at 06:45 PM 0
Share

If I remove the call to DestroyServerAssets() the behaviour becomes even weirder, see the 2nd part of the problem where I described what happens if the call does not happen. Then every instance crashes on loading the same map, contrary to the first problem where loading the same map worked in 5 / 6 cases.

0 Replies

· Add your reply
  • Sort: 

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

16 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

Related Questions

Show Debug.Log in the console interface with a linux headless build 1 Answer

Headless linux server 2 Answers

How to remove unneeded references (texture, audio) when doing headless server builds? 2 Answers

Headless mode checkbox is uncheckable 1 Answer

Linux Headless -- Application.Quit() doesn't work? 1 Answer


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