App crashes on mobile and safari

well yeah I can optimize a lot of things on the first 2 apps code wise, but think the meshes are ok just as they are now , I mean they work just fine and somehow part of what @shaderbytes was saying feels like a good guide, maybe those 2 apps are the line that one should not cross if you want your app to run properly on IOs so its a good thing to have there like a reference , and we got a saying in Spanish that goes along “You don’t fix what is working”, so right now I wouldn’t even mind leaving those 2 untouched.
But I appreciate your recommendation @carolhmj , I will take a look at some parts of the code of those 2 apps and see what I can optimize. for sure I can make the change to the .updateURL() code that I was using to change materials on command that @shaderbytes so kindly helped me fix on the 3rd app, and get rid of some material cloning that I know I don’t need , apart from that I don’t think there is much to change.

Well guys at this point I just discarded the possibility that the material-texture count is the one making the app crash, We drastically reduced the amount and the app is still crashing when the loader reaches 100% , I even got rid of the postprocess code on the loader success callback to make sure nothing there was causing it to crash, so right now it just downloads the model and displays it , nothing is done to the model, no clonning , no layer hiding , no material color corrections. any ideas on what should I check next ? I mean I kinda saw this coming, I felt deep inside my heart that it wasn’t just the texture count ahaha , but I get it , we had to be sure. so last texture count was 666 textures before cloning, now its 153 and add like 22 more for the texture options that I load at the beginning. Anyway I feel like we’re really up to something here cuz it is an odd situation, why would just this app crash when now all of the apps have almost the same specs, what am I missing ? it could be the key to fix IOs babylon mobile devices crashes.
Could anyone help me out looking for any error code or info on IOs device console trough a Mac PC ??

P.S: guess you have been working on something on the inspector code since the count tab it’s giving me some “cannot read properties of undefined” error when I click it, so the sandbox inspector count tab is the only one working for me right now. keep the good work guys !!

About the inspector, it should be ok if you update it as well as Babylon ?

can you share a repro of your minimal case where it is crashing even in PM so we can have a look ?

@sebavan Ahmm actually my project has the current scripts from your cdn like this :

<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
<script src="https://cdn.babylonjs.com/serializers/babylon.glTF2Serializer.min.js"></script>

so I guess the “count” tab on the inspector code was left with something off, cuz I’ve been trying to use it and I keep getting the same error which closes the scene explorer window :
image

and related to the crash on IOs devices I just found out that is model related , figured that out after trying to build a repro of my project on the playground , so I just imported the mesh and tried it in my iphone 6 and it crashes right after loading the model , like on the app, and I cant seem to see what’s wrong with this specific GLB ? is it too much for IOs? what do you guys think ? it isn’t that complex of a model , just some ordinary thrash cans.
look this is the repro: https://playground.babylonjs.com/#TWUH6V#1
of course there is no problem if you try it on a desktop or even android , but open it on IOs mobile device and it will crash.

Also used one of the GLB that work on IOs to the same playground and it runs just fine on any mobile : https://playground.babylonjs.com/#TWUH6V#3

@RaananW any idea where the version mismatched could come from ? looks like inspector would be older than babylon ?

@bghgary can you spot smthg wrong in the model for ios ? https://playground.babylonjs.com/#TWUH6V#1

This was just added, could have been a cache issue. Core’s nightly was updated. I will check again just to be sure, of course :slight_smile:

1 Like

Did you try remove the materials. There are 115 meshes and 115 materials in this scene. That’s 1 material for each mesh… Feels a bit weird. In the end, I believe it must be related to the timeout in iOS. And the time needed to generate 115 materials might just be too much. The mesh looks ok to me on a quick look. I don’t see anything around the naming or structure that could explain this. Also tried async, with a promise and using RightHanded system, doesn’t change anything. It’s really happening just on the loading model step. Only thing I noticed is it takes a hell of a time to load for such a simple object (even on desktop with high-speed Internet).

@mawa yeah actually it had maybe 4 or 5 times that , I mean in my app you would be able to configure up to 4 different cans so I clone that Model 4 times and get rid of the original, but that’s not the problem , actually none of that should be a problem , I have 2 other similar apps with similar models and materials count and they run so smooth on any device, this is the only Model that doesn’t, I have shared the link before but I’m gonna share it one more time:
http://magnuson.servexusinc.com/umea.html
http://magnuson.servexusinc.com/slope.html
this 2 models have 70 meshes 67 materials and 127 meshes 121 materials correspondingly, none of them represents a problem on IOs.
I was looking at the 3 GLB’s and the only thing I saw was different is that the one that is not working is smaller, 100 times smaller than Umea but just 2 or 3 times smaller than Slope. Don’t think that’s an issue right ? but I cant find anything else that is odd when compared to the first 2, should I build the Model from scratch ? could be some corruption on the file or something or am I just being paranoid with this ?

Certainly not. If anything, you will likely reproduce the same issue when redoing it.

I’m not gonna say it’s impossible. I experienced before. However the fact that it works anywhere else than iOS makes it very unlikely.

I think you should just try to break it down. As I said, I would start with removing all materials (ez enough), assign just one basic mat to all and see if it loads. If it doesn’t then you can say it is something about the mesh, the naming or the structure. If it’s a bug with a mesh transform, rather than redoing, create a new file and import/merge the content and make a new export. If it still bugs, start removing chunks of meshes until it doesn’t break anymore.

@mawa yeah you re right I didn’t want to go down this path cuz its really wasteful to break it down but if is the only option then that’s the way to go.

I don’t see anything specifically wrong with the asset other than it is highly repetitive in the textures.

Is it what makes the load time that high ? I am wondering indeed if we are not timing out ?

Yes, I know. Though I believe you already spent a lot of time on it and had the feedback from many experts. I know it’s tedious but in the end, it will take you a few hours to hopefully spot the error (where I believe you already spent more than that.
On another note, your objects look real nice. With that said, they also look like ‘product design’ objects. I don’t find they are really suitable for the project. I strongly believe I could get the same result with 10 (probably 20) times less weight. I mean, I did see all the parts that you can customize (and btw the site looks really great and actually the product design is really great too). But let’s face it, I would make an entire building or a block of houses for the weight and resources needed for your trash can. If I had only one good advise to give you at this stage (where you still have just 3 or a few models) would be to follow @shaderbytes input on this (and then mine :wink:) and drastically rething how you are creating these objects.

1 Like

@mawa ahahah yeah I get you I’ve thought about it too cuz it could be so much lighter but the thing is that it was just this close :pinching_hand: to be finished and I didn’t wanna redo the whole thing (and by redo I mean do more code to do the exact same thing that is doing now but with less geometry) , I was expecting it to be a silly mistake somewhere in the code that someone would incidentally spot, or even so a wrong usage of something that could also be of use to the babylon community to know what to look for when your app doesn’t run properly on IOs mobile devices, like a precedent. but yeah at the end my goal is have this app running everywhere , and if that’s what it takes well I’m gonna end up doing it too, just wanna make sure I run every possible quick solution before having to redo the whole thing. @mawa thanks for your comments ahah glad you like the work took lot of effort to get it there.

@bghgary @sebavan ahh sorry by the way thats the old GLB, I modified the page so the standard functioning would be avialable to people to use it , the other one is now under the name valutaN.glb on the same path , but is just the same without as many layers and PBR channel textures. I was using it just for this tests.

1 Like

Hello,
i don’t know if you’ve already tried this or if it can help at all.
I had the same problem and, thanks to this thread ( IOS crashing issue (severe) - #19 by guido_wikipoint ) I managed to avoid the memory leak on iOS devices by reducing the size of the model.
The tool I used, as kindly suggested by @guido_wikipoint :love_you_gesture:, is https://rapidcompact.com/

2 Likes

Woooowwww @ariwoot that tool really does its job man , I mean it has some compression settings that really sacrifice appearance quality but the one that says “Game engine” keeps quality and I used it and impressive enough it worked on IOs mobile device on this playground https://playground.babylonjs.com/#TWUH6V#11, I really cant explain what it did cuz the Model still have 155 materials, even more textures than the latest GLB I exported cuz this rapidCompact version has all 4 PBR channels for every material so it has 590 textures attached, I got rid of most channels until it was just albedo texture left so the number of materials and textures matched.
don’t know what it did but it worked , still I see that is on the verge of failing again cuz its running at 34 fps and sometimes reloads the page like if it was about to crash.


Cant get my head around this , how is this working with those specs ? , and why isn’t mine ? the one with the path to “valutaN.glb”.

Any thoughts on what this tool did here ? @sebavan @mawa @bghgary , anyone know what it did ?

so just to clarify https://magnuson.servexusinc.com/assets/valuta/models/valutaL2.glb is the one from rapidcompact and https://magnuson.servexusinc.com/assets/valuta/models/valutaN.glb is the one we built.

P.S: @ariwoot thanks for your help mate, we’ve been on this for days and you just seem to have solved the problem , really appreciate it.

1 Like

@bghgary might be good to diff them as I wonder if it could be a buffer layout thingy involving copies ?

I don’t see anything obvious. The rapidcompact one performs worse on my Windows machine (according to raw fps values).

Just remember even major 2D websites randomly reload at times and millions $ teams behind those. Also the litany of Unity threads of their team trying to fix those crashes, or Nike’s product viewer. Ive been in support tickets with apple recently over this and no bueno. There is zen once you accept there is no good answer.

If you have not yet, hook your iphone up with xcode open and watch its console. It’s likely you are getting at least some of the nefarious jetsam high watermark reloads.