Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.87k stars 826 forks source link

Uncaught ArgumentError: Error #3672 at starling.display::QuadBatch/createBuffers() #676

Open neuronix opened 9 years ago

neuronix commented 9 years ago

Hi,

This error is a nightmare. Has been triggering randomly for ages, now in latest Android release (built with AIR 17), thousands of users are getting it on first launch... without any major change the in app code (and no issues on testing devices: Galaxy S4, Galaxy S3 mini...).

Uncaught ArgumentError: Error #3672 at starling.display::QuadBatch/createBuffers() at starling.display::QuadBatch/syncBuffers() at starling.display::QuadBatch/renderCustom() at starling.core::RenderSupport/finishQuadBatch() at starling.core::RenderSupport/batchQuad() at starling.display::Image/render() at starling.display::DisplayObjectContainer/render() at starling.display::Sprite/render() at starling.display::DisplayObjectContainer/render() at starling.display::Sprite/render() at starling.display::DisplayObjectContainer/render() at starling.core::Starling/render() at starling.core::Starling/nextFrame() at starling.core::Starling/onEnterFrame()

Impossible to debug and causes the app to crash.

I don't know if this is a Starling bug or an AIR / Flash bug but Starling is supposedly backed by Adobe. Is there no way of getting them to actually fix theses bugs?

Another one I reported that has been closed by adobe that still occurs thousands of times per day on our userbase (finally overrid starling & try catched the rendering..) : https://github.com/Gamua/Starling-Framework/issues/630

tushar2708 commented 9 years ago

Hi everyone,

We were working on reproducing these issues. As it seems, these are multiple issues that are being discussed here. So, I would put up a summary for the same here.

A. The ScrollText component of the feathers UI isn't displayed on a Nexus 4 with Android 5.1 but no errors are shown.

UPDATE : The issue "The ScrollText component of the feathers UI isn't displayed on a Nexus 4 with Android 5.1 but no errors are shown." isn't reproducible on Nexus 4, though I could see an issue of ScrollText disappearing on clicking in 18.0.0.109, which is fixed in later builds. Does that match anyone's observation ? Can you test it again on latest AIR build and if reproducible, can you provide a sample project for the same ?

B. And when displaying Starling images with different alpha (say some alpha = 1, and some alpha = 0.99) would crash too.

UPDATE : Not reproducible.

C. StageText component isn't displayed with the latest beta 18.

UPDATE : Not reproducible.

However, we will need some clarification on the scenario. It seems that these issues are reported for different devices and with different AIRSDK builds. Can you please provide the AIRSDK version and the device on which these issues were reproduced at your end ?

Moreover, It would be helpful if you also specify which issue you are talking about, when you say that "it's working", or "not working". This way, it will be easier for us to track the issues, reproduce and fixing. Also consider logging different bugs for different issues on https://bugbase.adobe.com/

-Tushar, Adobe AIR team

grosssmutttr commented 9 years ago

ScrollText is working now.

I discovered a problem when an interstitial ad is displayed. The feathers UI elements are displayed as black squares after closing the interstitial ad.

This doesn't happen everytime. I think this has someting to do with lost context but I can't get an error log out of this behaviour...(adb and flash builder 4.7)

I experienced this on a Samsung S2 (Android 4.4.2) and S3. On the Nexus 4 this issue doesn't appear.

Adobe AIR SDK version 18.0.0.180

tushar2708 commented 9 years ago

Hi Grosssmutttr, Can you provide us a sample project for the "interstitial ad-feathers UI elements" issue, in which you can reproduce the issue ? That will help us find the issue with more accuracy. -Tushar Adobe AIR Team

PrimaryFeather commented 9 years ago

@shamruk just posted an interesting find connected to this issue: #757

In a nutshell, he says that making the following calls in an "Event.ACTIVATE" made this error go away:

Starling.current.context.clear();
Starling.current.context.present();

Could those of you who are still having problems try that out, and post your results here?

(And while I'm already posting: @grosssmutttr, any sample project for you particular problem would really help Adobe figure this out!)

kiripu commented 9 years ago

@PrimaryFeather Hello. I've got the same error but from FragmentFilter class. Error #3672. FragmentFilter/UpdateBuffers. And this code don't help:

Starling.current.context.clear(); Starling.current.context.present();

Device: Samsung Galaxy Tab 2 7.0 OS: android 4.4.4 AIR SDK: 19.0.0.193

jareth commented 8 years ago

We are also still getting the #3672 error on some Samsung devices. I tracked down the cause in Context3D, created a reproducible case using pure Stage3D, and created a new bug at Adobe for this. It may be relevant to some of the errors reported here.

neuronix commented 8 years ago

@jareth Thanks for this information! Awesome work.

@PrimaryFeather would it be possible to add the workaround to Starling 1.8? It will take time for AIR to be fixed and also, some of us are blocked on AIR19 due to the latest windows bugs in AIR20/21 so we wouldn't be able to use the fixed version quite yet.

jareth commented 8 years ago

@neuronix We currently have a workaround in place (but in Starling 1.6, because we are still using it) you can see in our fork We also needed to make sure to pass true to Starling.stop(true) to ensure rendering was suspended, and add an extra frame delay after ACTIVATE before Starling.start(). We are still testing our fixes, so there may be other cases.

PrimaryFeather commented 8 years ago

Thanks a lot for this great work, @jareth! I added your fix to Starling 1.8. Please let me know if that works for you, guys! I can do the same for the master branch if this is successful. :smile:

jareth commented 8 years ago

Some promising news: our test device that was having this issue auto-updated itself to Android 6.0 in the last week and it seems the issue no longer occurs in the new version. Not the perfect solution as many devices will probably take a long time to be updated, but at least the number of affected devices shouldn't keep growing as they start shipping with Marshmallow.

PrimaryFeather commented 8 years ago

That's great news, thanks a lot for the update on this!

skolesnyk commented 8 years ago

@PrimaryFeather , I've pulled bdf96dd. Bugsnag has reported this error. Could be because of device/android combo.

ArgumentError·Error #3672 Raw starling.display::QuadBatch:0createBuffers() starling.display::QuadBatch:0syncBuffers()

device: manufacturer XiangDe model Camelio Family tablet osName Android osVersion 4.1.1

Alejandro131 commented 8 years ago

@PrimaryFeather Same as skolesnyk, pulled the latest code from 1.8.x and submitted an update version of my app to android, received a crash from this device, so I don't think it is safe to say that Android 6.0 fixes the problem.

OS_NAME - Android OS_VERSION - 6.0.1 PRODUCT_MODEL - SM-G930F PRODUCT_BRAND - samsung

ArgumentError: Error #3675 at starling.textures::ConcreteTexture/uploadBitmapData() at starling.textures::Texture$/fromBitmapData() at starling.text::TextField/createRenderedContents() at starling.text::TextField/redraw() at starling.text::TextField/render() at starling.display::DisplayObjectContainer/render() at starling.display::Sprite/render() at starling.display::DisplayObjectContainer/render() at starling.core::Starling/render() at starling.core::Starling/nextFrame() at starling.core::Starling/onEnterFrame()

PrimaryFeather commented 8 years ago

Damn. So, in other words: that commit, plus Android 6, alleviate the issue, but it's still no fix. :disappointed:

Nevertheless: thanks for the reports, to both of you!

skolesnyk commented 8 years ago

Well, I have to look into the matter better. My problem could have been that I called Texture.fromBitmap right after startling.start().

Now I've added 0.5 sec delay — this issue no longer pops in in Bugsnag!

PrimaryFeather commented 8 years ago

My problem could have been that I called Texture.fromBitmap right after startling.start().

That might be a little risky, because the context might not be ready yet. Ideally, you should wait for the "ROOT_CREATED" event before accessing the context. That said: doesn't have to be connected, of course. ;-)

skolesnyk commented 8 years ago

That's how it looks like

mStarling.addEventListener( Event.ROOT_CREATED ,
    function onRootCreated ( event :Object , app :App ) :void {

        //new MaterialCyanLimeMobileThemeWithAssetManager();
        new MaterialCyanLimeMobileThemeWithAssetManager().addEventListener( Event.COMPLETE , onThemeAssetsReady );

        function onThemeAssetsReady ( event :Event ) :void {
            event.currentTarget.removeEventListeners();
            // From now on you can start creating your Feathers UI
        }
        mStarling.removeEventListener( Event.ROOT_CREATED , onRootCreated );
        mStarling.start();

        Starling.juggler.delayCall(function():void {
            var bgTexture :Texture = Texture.fromBitmap( background , false , false );
            app.start( bgTexture , assets );
            removeChild( background );
            Starling.juggler.delayCall(function():void {
                _dialogInit.dismiss();
                _dialogInit.dispose();
                _dialogInit = null;
                background.bitmapData.dispose();
                background = null;
            },1)  ;

        }  , 0.5);
    } );
PrimaryFeather commented 8 years ago

Ah, I see. Hm, with that setup, the delayed calls shouldn't be necessary. The context is finished setting up in the "ROOT_CREATED" callback. But if it helps, it definitely doesn't hurt!

skolesnyk commented 8 years ago

I think I was getting errors in Texture.fromBitmap before I've used commit bdf96dd536b4abb38605dea7959af1166ec98749 I'll report new findings from Bugsnag.

skolesnyk commented 8 years ago

@PrimaryFeather

Why would this error be reappearing? It's happening right at this line

var bgTexture :Texture = Texture.fromBitmap( background , false , false );

ArgumentErrorstarling.textures::ConcreteTexture:0 Error #2015 starling.textures::ConcreteTexture:0 uploadBitmapData() Function:0Texture.as$2:anonymous() starling.textures::ConcreteTexture:0onContextCreated() starling.events::EventDispatcher:0invokeEvent() starling.events::EventDispatcher:0dispatchEvent() starling.events::EventDispatcher:0dispatchEventWith() starling.core::Starling:0initializeGraphicsAPI() starling.core::Starling:0initialize() starling.core::Starling:0onContextCreated()

PrimaryFeather commented 8 years ago

Could it be that that the "background" bitmap was somehow disposed before it's being passed to this method?

skolesnyk commented 8 years ago

It's highly untypical error, but it still occurs.

Then, I guess I have to set longer delay here, but since fromBitmap is not async call, I'm not sure it'd help.

 Starling.juggler.delayCall(function():void {
                _dialogInit.dismiss();
                _dialogInit.dispose();
                _dialogInit = null;
                background.bitmapData.dispose();
                background = null;
            },1)  ;
PrimaryFeather commented 8 years ago

Beware that when you create a texture via Texture.fromBitmap() and do not set a custom texture.root.onRestore callback, Starling will try to re-use the bitmap data in case of a context loss. So if you dispose that background bitmap data and a sometime later the context is lost, this error will appear. Thus, I recommend either using the AssetManager, or Texture.fromEmbeddedAsset (if applicable), which will both load the texture from its source on a context loss — or to simply not disposing the bitmap.

skolesnyk commented 8 years ago

Oh I should have be more clear. This background bitmap is actually a splash image used only once.

  [Embed(source="/bkgs/bkg.png")]
  private static var BackgroundAll :Class;
....

background = new BackgroundAll();
            background.x = 0;
            background.y = 0;
            background.smoothing = true;

            setStageAndViewPort();
            addChild( background );
initStarling();

initStarling has

 mStarling.addEventListener( Event.ROOT_CREATED ,
   mStarling.start();
PrimaryFeather commented 8 years ago

Ah, I see! But still, that texture is used is used for a while, right? And the context could be lost in that time frame. I recommend you simply remove that background.bitmapData.dispose() call, just to be sure. Instead, when you no longer require the texture, dispose that — then the bitmap data will be removed by the garbage collector sooner or later. That should probably suffice, and can't have any evil side effects. :smile:

skolesnyk commented 8 years ago

Thank you!

PrimaryFeather commented 8 years ago

You're very welcome! :smile:

skolesnyk commented 8 years ago

Getting like 88 errors of this type from just one user. Bugsnag unfortunately doesn't show where this error happens. I wonder if getting one of the previous commit 1.8.x commits would fix the issue?

ArgumentError·Error #3672 Raw starling.display::QuadBatch:0createBuffers() starling.display::QuadBatch:0syncBuffers() starling.display::QuadBatch:0renderCustom() starling.core::RenderSupport:0finishQuadBatch() starling.core::Starling:0render() starling.core::Starling:0nextFrame() starling.core::Starling:0onEnterFrame()

User's device: manufacturer samsung model SM-G920T1 osName Android osVersion 5.0.2

skolesnyk commented 8 years ago

There were several reports with this error, but only once per device. But then there's one device that has reported 872 errors. Oh it's the same device. My newest app release uses

ArgumentErrorstarling.display::QuadBatch:0 Error #3672 ArgumentError·Error #3672

manufacturer samsung model SM-G920T1 osName Android osVersion 5.1.1

idanasher commented 8 years ago

THANK YOU shamruk !!! Your solution worked for as well !! I have also suffered a lot because of this #3672 bug.. One Important Thing - just putting those 'present' & 'clear' commands did not worked for me. but when I did the following it worked: when the app is activated again, I call the 'present' & 'clear', then I WAIT a few frames, I put a delay of 0.5 second, and only then I proceed with my game graphics and logic stuff, including Starling.current.start()...

I guest that clearing the starling buffer should be completed with no "interfering". THANKS AGAIN :) it is a happy day for me

btw, this bug used to happen to me only on Samsung galaxy S7 smartphone and now it not occurring anymore... Developing with : Air 21 for Android & Starling 2.0

ZwickTheGreat commented 7 years ago

Just received this error on Android with AIR 27.

manufacturer HUAWEI

model ALE-L21

osName Android

osVersion 6.0

screenSize 720 x 1280

Using ATF and png POT textures.

raresn commented 2 years ago

@PrimaryFeather We still have this piece of code on each starling start after deactivate to fix Error #3672: Starling.current.context.clear(); Starling.current.context.present(); Is it still needed nowdays? Any clue if there is something we should do? Right now this results in a screen flicker - would be nice not to have it :)

PrimaryFeather commented 2 years ago

Since I could never reproduce this myself, the honest answer is "I don't know". 😬 My gut feeling is that it's no longer necessary, because otherwise there would be more recent reports of the problem. I'm not using that workaround in a game I've got out in the wild at the moment, and it runs very stable.

Maybe anyone else who is reading this can share their experiences?

raresn commented 2 years ago

@PrimaryFeather I think i will just remove the code, and keep my eyes open if this error comes back. Thank you for your feedback!

PrimaryFeather commented 2 years ago

Yeah, that sounds like a good plan – I don't think it's too much of a risk, as long as you keep your eyes open for the error. Good luck! 😄

itlancer commented 1 year ago

For me such issues (ArgumentError: Error 3672) fixed with latest AIR 50.2.3.7 if you using video playback on Android with Starling/Stage3D.