funwithflutter / flutter_confetti

A Flutter widget that shoots confetti all over the screen.
https://pub.dev/packages/confetti
MIT License
439 stars 79 forks source link

Example project is crashing 500ms into the blast #70

Open MrHazee opened 2 years ago

MrHazee commented 2 years ago

Hi,

My project started to crash when blasting confetti so I made a new clean project and ran the example and it also crashes 500ms into the blast. Ive tried on an iPhone 11 and ipad 12.9-inch simulator. This is from "flutter run -v": [ +1 ms] DevFS: Deleting filesystem on the device (file:///Users/------------/Library/Developer/CoreSimulator/Devices/D61AB314-2F91-4E3C-B917-0663779B904F/data/Containers/Data/Application/79CD32A1-6125-4002-9609-E0C 2D236C848/tmp/confetti_testKa9sJj/confetti_test/) [ +254 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed [ +7 ms] "flutter run" took 115 946ms. [ +113 ms] ensureAnalyticsSent: 109ms [ ] Running shutdown hooks [ ] Shutdown hooks complete [ ] exiting with code 0

Im on M1 Max and flutter master channel

Any idea whats happening? Thanks

HayesGordon commented 2 years ago

Hey! Maybe it's Impeller, the new rendering engine (if you enabled it)? Is this happening on stable as well?

cristian1980 commented 2 years ago

Crashes for me too, I am using:

Flutter 3.4.0-19.0.pre.88 • channel master • https://github.com/flutter/flutter.git Framework • revision 96b72232bd (28 hours ago) • 2022-09-06 09:29:05 -0400 Engine • revision 7595e09968 Tools • Dart 2.19.0 (build 2.19.0-171.0.dev) • DevTools 2.17.0

It crashes on both iphone and android.

cristian1980 commented 2 years ago

I switched to the stable flutter channel and it does not crash.

MrHazee commented 2 years ago

Yes I can confirm. Stable is ok. Im sure it has to do with the Impeller

olof-dev commented 1 year ago

I'm finding this as well, with both the 3.4 and 3.6 beta releases of Flutter. Has anyone discovered why it's crashing on these? For example, if it's because of Impeller, then what is it that Impeller doesn't like?

Assuming it's a bug with Flutter/Impeller rather than Confetti, has anyone reported this on the Flutter repository?

sunderee commented 1 year ago

It's crashing for me as well. I'm using a beta version of Flutter.

flutter --version
Flutter 3.7.0-1.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision e599f02c7a (12 days ago) • 2022-12-08 01:07:24 +0530
Engine • revision 4971c5b2e7
Tools • Dart 2.19.0 (build 2.19.0-444.1.beta) • DevTools 2.20.0
flawnn commented 1 year ago

Same for me as the others, also on the beta channel: Flutter 3.7.0-1.2.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision c29b09b878 (5 days ago) • 2022-12-19 18:30:12 -0600 Engine • revision 8c99b0feaf Tools • Dart 2.19.0 (build 2.19.0-444.2.beta) • DevTools 2.20.0

Segfaults apparently, here the error log:

F/libc    (13973): Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x6f0bdddeb8 in tid 14064 (1.ui), pid 13973 (lawn.bling_task)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/oriole/oriole:13/T2B1.221118.006/9375477:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2022-12-24 17:24:17.731208144+0100
Process uptime: 31s
Cmdline: eu.flawn.bling_task
pid: 13973, tid: 14064, name: 1.ui  >>> eu.flawn.bling_task <<<
uid: 10421
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x0000006f0bdddeb8
    x0  0000006d0679a1e9  x1  0000006d06799749  x2  0000006d0679a1e9  x3  0000000000000000
    x4  0000000000000000  x5  0000006d05ff1ca1  x6  0000006d05b4ae71  x7  0000000000003739
    x8  b40000707a8e8930  x9  0000000000000000  x10 0000006ea308cdf0  x11 0000000000000001
    x12 0000000000000001  x13 0000000000000001  x14 0000006ea26156ac  x15 0000006ea010de18
    x16 0000000000001418  x17 0000006d05ff11b1  x18 0000006e9ec4e000  x19 b40000707a8e8930
    x20 b40000704a8d0248  x21 b40000704a8d0268  x22 0000006d00008081  x23 b40000704a8d05e8
    x24 0000006d063ccb81  x25 0000006ea0034000  x26 b40000707a8e8930  x27 0000006d063ccb50
    x28 000000080000006d  x29 0000006ea010de48
    lr  0000006f0bdbfb6c  sp  0000006ea0034000  pc  0000006f0bdddeb8  pst 0000000020001000
backtrace:
      #00 pc 000000000005deb8  [anon:dart-code]

It has to do with the particle amount thrown off. If I reduce the particels to 5, it can execute once but not the second time anymore. I suppose it has to do with the GC'ing of the particle objects on the screen? Hope this helps.

HayesGordon commented 1 year ago

Thanks for reporting @flawnn. Can you confirm if this also happens on a profile/release build? I tested and for me (at least on macOS build) it only happens for debug.

HayesGordon commented 1 year ago

Seems like it's happening in the vector_math package with the call to normalize https://github.com/funwithflutter/flutter_confetti/blob/63009ac07b51fe8376ac9011123dafb696947188/lib/src/particle.dart#L268

What is super weird is if I modify the function by adding a print it works:

  /// Normalize this.
  double normalize() {
    final l = length;
    if (l == 0.0) {
      print('what is going on'); // added this print
      return 0.0;
    }
    final d = 1.0 / l;
    _v2storage[0] *= d;
    _v2storage[1] *= d;
    return l;
  }

This makes me think it's a compiler/debugger issue. Seeing as it's working on an ahead of time build.

mariopepe commented 1 year ago

Seems like it's happening in the vector_math package with the call to normalize

https://github.com/funwithflutter/flutter_confetti/blob/63009ac07b51fe8376ac9011123dafb696947188/lib/src/particle.dart#L268

What is super weird is if I modify the function by adding a print it works:

  /// Normalize this.
  double normalize() {
    final l = length;
    if (l == 0.0) {
      print('what is going on'); // added this print
      return 0.0;
    }
    final d = 1.0 / l;
    _v2storage[0] *= d;
    _v2storage[1] *= d;
    return l;
  }

This makes me think it's a compiler/debugger issue. Seeing as it's working on an ahead of time build.

If you could report this to Dart it would be AMAZING. I don't have enough of an understanding to make a good report ☹️

tusharuit25 commented 1 year ago

Still this crash this update is in latest version though it cash on iOS simulator