Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when reuse JavascriptRuntime instance #27

Closed
cacard opened this issue Dec 22, 2020 · 4 comments
Closed

crash when reuse JavascriptRuntime instance #27

cacard opened this issue Dec 22, 2020 · 4 comments

Comments

@cacard
Copy link

cacard commented Dec 22, 2020

F/libc (11765): Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc5381d58 in tid 11794 (1.ui), pid 11765 (com.app)


Build fingerprint: 'google/sdk_gphone_x86_arm/generic_x86_arm:11/RSR1.201013.001/6903271:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
Timestamp: 2020-12-22 01:40:36+0000
pid: 11765, tid: 11794, name: 1.ui >>> com.app <<<
uid: 10154
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc5381d58
eax c5381d58 ebx b087cc18 ecx c4adcaff edx ffffffff
edi c373f910 esi f4411780
ebp c373f908 esp c373f8e0 eip b079a68a
backtrace:
#00 pc 0001a68a /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#1 pc 0004006b /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#2 pc 00035115 /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#3 pc 00025f1b /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#4 pc 00042793 /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#5 pc 0004e7ed /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#6 pc 00042af6 /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#7 pc 000429d8 /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (JS_Eval+216) (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#8 pc 000085b5 /data/app/~~7QayOaFJendF_Gas0AwqMA==/com.app-2XP4A1LweVaYzb45e0av4g==/lib/x86/libfastdev_quickjs_runtime.so (JSEvalWrapper+165) (BuildId: 3ff1dc3d93b4aab2ab87aadff0bdff8e59b2b960)
#9 pc 000033d7 anonymous:c2580000
Lost connection to device.

@abner
Copy link
Owner

abner commented Dec 22, 2020

Hi. I just need more details. What javascript code are you trying to evaluate?

@cacard
Copy link
Author

cacard commented Dec 26, 2020

Hi. I just need more details. What javascript code are you trying to evaluate?

when I compile to Android apk and run, click more than 5 times, will be crash, everytime.
code like this:

    class _HomeState extends State<Home> {
      JavascriptRuntime rt;
    
      @override
      void initState() {
        super.initState();
        rt = getJavascriptRuntime();
      }
    
      @override
      Widget build(BuildContext context) {
        return Container(
          child: GestureDetector(
            child: Text('run js'),
            onTap: () {
              JsEvalResult result = rt.evaluate('1+1;');
              print('result:$result');
            },
          ),
        );
      }
    }

and log is :

Syncing files to device MI 6...
I/flutter (11391): RESULT creating sendMessage function: function sendMessage(channelName, message) {
I/flutter (11391): return FLUTTER_JS_NATIVE_BRIDGE_sendMessage.apply(globalThis, [channelName, message]);
I/flutter (11391): }
I/flutter (11391): SET TIMEOUT EVAL RESULT: 1
I/flutter (11391): result:2
I/chatty (11391): uid=10006(com.lcq.flutter_demo) 1.ui identical 2 lines
I/flutter (11391): result:2
I/cq.flutter_dem(11391): ProcessProfilingInfo new_methods=578 is saved saved_to_disk=1 resolve_classes_delay=8000
I/flutter (11391): result:2
I/flutter (11391): result:2
I/flutter (11391): result:2
I/flutter (11391): result:2
I/chatty (11391): uid=10006(com.lcq.flutter_demo) 1.ui identical 2 lines
I/flutter (11391): result:2
I/flutter (11391): result:2
I/flutter (11391): result:2
I/chatty (11391): uid=10006(com.lcq.flutter_demo) 1.ui identical 26 lines
I/flutter (11391): result:2
I/flutter (11391): result:2
I/chatty (11391): uid=10006(com.lcq.flutter_demo) 1.ui identical 10 lines
I/flutter (11391): result:2

there is no problem when code like this:

    onTap: () {
      JsEvalResult result = getJavascriptRuntime().evaluate('1+1;');
      print('result:$result');
    },

I want reuse JavascriptRuntime.

@cacard cacard changed the title crash when invoke sendMessage crash when reuse JavascriptRuntime instance Dec 26, 2020
@cacard
Copy link
Author

cacard commented Dec 26, 2020

seem like the log of flutter using print('1) when on tap, the output log aways same, then flutter's log will not output!
en....

@abner
Copy link
Owner

abner commented Apr 4, 2021

could not reproduce it. Please check the most recent versions.

@abner abner closed this as completed Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants