Crash when Switching Build Targets

[EDIT]
For reference:
5.6.0xb3 gets stuck on loading PNG resources - deadlock of some sort - Unity Engine - Unity Discussions seems to be the same Issue. A possible “Workaround” is to switch away from ETC to another Compression Method. See possible other fixes in above thread.
[/EDIT]

Hi, on Ubuntu 16.10 and Unity 5.6x03 I’m experiencing a strange behavior:
(It also happens on 5.5 and 5.6x01)

When Switching Platforms in the Build Settings from PC to Android, the process halts when processing some Textures and hangs. After a while I need to force close Unity. Unity writes the Texture last displayed into Library/CrashedAssetImports.txt.

Deleting the “offending” Texture will cause it to hang on another one, seemingly at random.

The process hangs on jpg and png textures, also texture resizing did not solve the issue. Replacing the images with random picks from Google Images also did not work.

“top” does not show any noticeable activity for Unity.

Moving my Assets/Textures folder out of the project entirely allows me to switch the Platform to Android without issues.

Moving the folder back after the switch (With Unity still open) then allows me to successfully build the project.

Any ideas how I can debug this further? I can’t seem to find any more detailed crash logs of the spawned processes?

I have made a bit of progress homing in on the issue by using Command Line builds:

/opt/Unity/Editor/Unity -projectPath ~/git/project -batchmode -buildTarget linux “builds/linux” -quit -logFile /dev/stdout

works fine, however:

/opt/Unity/Editor/Unity -projectPath ~/git/project -batchmode -buildTarget android “builds/android.apk” -quit -logFile /dev/stdout

Stops here (Removing golf_ball_texture below just causes it to hang on the next Texture):

— cut —
Refreshing native plugins compatible for Editor in 0,32 ms, found 2 plugins.
Couldn’t open /opt/Unity/Editor/Data/UnityExtensions/Unity/VR/Android/AudioPluginOculusSpatializer.so, error: /opt/Unity/Editor/Data/UnityExtensions/Unity/VR/Android/AudioPluginOculusSpatializer.so: wrong ELF class: ELFCLASS32

(Filename: /home/builduser/buildslave/unity/build/Runtime/Misc/Plugins.cpp Line: 194)

Preloading 1 native plugins for Editor in 0,23 ms.

----- Total AssetImport time: 0,096500s, AssetImport time: 0,063636s, Asset hashing: 0,000000s [0 B, 0,000000 mb/s]

Refresh: detecting if any assets need to be imported or removed … Refresh: elapses 0,007601 seconds (Nothing changed)
Determining assets that need to be reimported for target platform … 0,054878 seconds.

Hashing assets … 0,000 seconds
file open: 0,000 seconds (0 files)
file read: 0,000 seconds (0,000 MB)
hash: 0,000 seconds

Hashing assets … 0,002 seconds
file open: 0,002 seconds (6 files)
file read: 0,000 seconds (1,078 MB)
hash: 0,001 seconds
Updating Assets/Textures/golf_ball_texture__by_lylejk-d3il10u.png - GUID: 10fd29412feba47fa9d5b10fe4ab1a7c…
— cut —

An strace on the build process stops here:
— cut —
open(“/path/to/project/Temp”, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 35
fstat(35, {st_mode=S_IFDIR|0755, st_size=4096, …}) = 0
getdents(35, /* 7 entries */, 32768) = 320
madvise(0x2a88c9b0e000, 65536, MADV_DONTNEED) = 0
close(35) = 0
stat(“/path/to/project/Temp/c2dd4a271fc7847288654a92ccc02e79-res.pvr”, {st_mode=S_IFREG|0664, st_size=32835, …}) = 0
unlink(“/path/to/project/Temp/c2dd4a271fc7847288654a92ccc02e79-res.pvr”) = 0
futex(0x2a88c504db98, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, ffffffff
— cut —

and just hangs… (the hash for the .pvr above changes on every call)

I can send it an SIGTERM to which it reacts but just returns to the above futex call:

— cut —
) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
— SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=19036, si_uid=1000} —
rt_sigaction(SIGTERM, {0x24dff48, [TERM], SA_RESTORER|SA_RESTART, 0x7fcba8cee860}, {0x24dff48, [TERM], SA_RESTORER|SA_RESTART, 0x7fcba8cee860}, 8) = 0
rt_sigreturn({mask=[ ]}) = 202
futex(0x2d81978f2b98, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, ffffffff
— cut —

Killing it with -9 will then obviously exit.