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

camera/possibleSettingOptions segfaults using MAVSDK-Java 2.0.1 and MAVSDK-server-Android 2.0.0 #155

Open
rayw-dronesense opened this issue Mar 13, 2024 · 13 comments

Comments

@rayw-dronesense
Copy link

rayw-dronesense commented Mar 13, 2024

This did not occur with previous version 1.3.2

2024-03-13 17:39:40.622 25779-26537 libc++abi               com.dronesense.pilot                 E  terminating with uncaught exception of type std::invalid_argument: stoul: no conversion
2024-03-13 17:39:40.622 25779-26537 libc                    com.dronesense.pilot                 A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 26537 (RxCachedThreadS), pid 25779 (ronesense.pilot)
2024-03-13 17:39:40.633 25779-26540 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2024-03-13 17:39:40.633 25779-26540 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2024-03-13 17:39:40.633 25779-26540 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2024-03-13 17:39:40.633 25779-26540 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2024-03-13 17:39:40.638 25779-26416 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2024-03-13 17:39:40.645 25779-26416 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2024-03-13 17:39:40.725 25779-25779 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Landroid/view/View;->getViewRootImpl()Landroid/view/ViewRootImpl; (greylist, reflection, allowed)
2024-03-13 17:39:40.729 26548-26548 DEBUG                   pid-26548                            A  pid: 25779, tid: 26537, name: RxCachedThreadS  >>> com.dronesense.pilot <<<
2024-03-13 17:39:40.730 25779-25779 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden field Landroid/view/View$AttachInfo;->mVisibleInsets:Landroid/graphics/Rect; (greylist, reflection, allowed)
2024-03-13 17:39:40.730 25779-25779 ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden field Landroid/view/ViewRootImpl;->mAttachInfo:Landroid/view/View$AttachInfo; (greylist, reflection, allowed)
2024-03-13 17:39:40.730 26548-26548 DEBUG                   pid-26548                            A        #01 pc 00000000000d1cc0  /data/app/com.dronesense.pilot-RbUkTiXzrdIfRxYjrPikzQ==/base.apk!libc++_shared.so (offset 0xfb3000) (BuildId: a59088f9640cd272bc9542d94dc84a0c88afd558)

Repro code

        system.camera.possibleSettingOptions.subscribe {
            it?.forEach {
                log.e("RAWR: ${it?.settingDescription}")
            }
        }
@JonasVautherin
Copy link
Collaborator

Maybe you could try to reproduce it in C++? That would make it easier to debug.

@rayw-dronesense
Copy link
Author

@JonasVautherin Thanks for getting back to me, I'm not sure how one would do that on Android.

I was able to get more detailed logs by removing log filters,

2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and float
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and float
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and float
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and float
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and float
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and uint32_t
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Comparison type mismatch between uint8_t and uint32_t
2024-03-14 11:55:06.930  4661-5594  Mavsdk                  com.dronesense.pilot                 W  Trying to compare different types.
--------- beginning of crash
2024-03-14 11:55:06.930  4661-5594  libc++abi               com.dronesense.pilot                 E  terminating with uncaught exception of type std::invalid_argument: stoul: no conversion
2024-03-14 11:55:06.930  4661-5594  libc                    com.dronesense.pilot                 A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5594 (RxCachedThreadS), pid 4661 (ronesense.pilot)
2024-03-14 11:55:06.932  4661-5598  ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2024-03-14 11:55:06.957  4661-5407  ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2024-03-14 11:55:06.957  4661-5598  ronesense.pilo          com.dronesense.pilot                 W  Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
...
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  Build fingerprint: 'qti/kona/kona:10/V1.0.0.17/eng.jenkin.20230915.165135:userdebug/test-keys'
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  Revision: '0'
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  ABI: 'arm64'
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  Timestamp: 2024-03-14 08:55:07-0700
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  pid: 4661, tid: 5594, name: RxCachedThreadS  >>> com.dronesense.pilot <<<
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  uid: 10120
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A  Abort message: 'terminating with uncaught exception of type std::invalid_argument: stoul: no conversion'
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x0  0000000000000000  x1  00000000000015da  x2  0000000000000006  x3  0000007d6f4086e0
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x4  ff6d6e6872716475  x5  ff6d6e6872716475  x6  ff6d6e6872716475  x7  7f7f7f7f7f7f7f7f
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x8  00000000000000f0  x9  cc32b44918147016  x10 0000000000000001  x11 0000000000000000
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x12 fffffff0fffffbdf  x13 0000000065f31dda  x14 003731a364064800  x15 00004350de94e70b
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x16 0000007ec61468c0  x17 0000007ec6122910  x18 0000007d2b6d2000  x19 0000000000001235
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x20 00000000000015da  x21 00000000ffffffff  x22 0000007d6f408810  x23 0000007d6f408850
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x24 0000007d6f408930  x25 0000007d6f408878  x26 0000007d6f408f18  x27 0000007d84323cd0
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      x28 0000007dc3f22700  x29 0000007d6f408780
2024-03-14 11:55:07.073  5614-5614  DEBUG                   pid-5614                             A      sp  0000007d6f4086c0  lr  0000007ec60d40c4  pc  0000007ec60d40f0
2024-03-14 11:55:07.074  5614-5614  DEBUG                   pid-5614                             A  
                                                                                                    backtrace:
2024-03-14 11:55:07.074  5614-5614  DEBUG                   pid-5614                             A        #00 pc 00000000000830f0  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 21847aa9757f000b0461310a9f5e6e51)
2024-03-14 11:55:07.074  5614-5614  DEBUG                   pid-5614                             A        #01 pc 00000000000d1cc0  /data/app/com.dronesense.pilot-GkDbKAZ1krjjpU4_zdAUxg==/base.apk!libc++_shared.so (offset 0xfb3000) (BuildId: a59088f9640cd272bc9542d94dc84a0c88afd558)

@rayw-dronesense
Copy link
Author

I was finally able to grab the Tombstone for the crash,

tombstone_33.zip

@JonasVautherin
Copy link
Collaborator

I'm not sure how one would do that on Android.

No need to do it from Android: try to reproduce in C++ from your computer 😊

@rayw-dronesense
Copy link
Author

@JonasVautherin - Hmm...I'm unsure on how to do this on the computer - the camera module only emits with the real drone, as far as I'm aware, and it is connected via this Android-based controller.

@JonasVautherin
Copy link
Collaborator

Oh, I see... What controller is that?

@julianoes
Copy link
Contributor

std::invalid_argument: stoul: no conversion'

Can you share the xml camera definition file that it parses? Using that we should be able to spot the problem or reproduce it?

@rayw-dronesense
Copy link
Author

rayw-dronesense commented Mar 15, 2024

Sure, here is one,

<?xml version="1.0" encoding="UTF-8" ?>
<mavlinkcamera>
    <definition version="19">
        <model>Greenseer EO v1.0</model>
        <vendor>XXXXXXXXXXXXXXXXXXX</vendor>
    </definition>
    <parameters>
        <!-- control = 0 tells us this should not create an automatic UI control -->
        <parameter name="CAM_MODE" type="uint8" default="0">
            <description>Camera Mode</description>
            <!-- This tells us when this parameter changes, these parameters must be updated (requested)-->
            <options>
                <option name="Photo" value="0">
                    <!-- This tells us when Camera Mode is set to Photo mode, the following parameters should be ignored (hidden from UI or disabled)-->
                    <exclusions>

                    </exclusions>
                </option>
                <option name="Video" value="1">
                    <!-- Conversely, when Camera Mode is set to Photo mode, the following parameters should be ignored (hidden from UI or disabled)-->
                    <exclusions>
                    </exclusions>
                </option>
            </options>
        </parameter>
        <parameter name="CAM_VIDRES" type="uint8" default="1">
            <description>Video Resolution</description>
            <options>
                <!-- 4096 x 2160 -->
                <option name="3840 x 2160 30fps (UHD)" value="1"></option>
                <option name="1920 x 1080 12-Bit Binned 10fps (HD)" value="2"></option>
            </options>
        </parameter>
        <parameter name="CAM_WBMODE" type="uint32" default="1">
            <description>White Balance Mode</description>
            <options>
                <option name="Off" value="0" />
                <option name="Auto" value="1" />
                <option name="Incandescent" value="2" />
                <option name="Fluorescent" value="3" />
                <option name="Warm Fluorescent" value="4" />
                <option name="Daylight" value="5" />
                <option name="Cloudy Daylight" value="6" />
                <option name="Twilight" value="7" />
                <option name="Shade" value="8" />
            </options>
        </parameter>
        <parameter name="CAM_EXPMODE" type="uint32" default="1">
            <description>Exposure Mode</description>
            <updates>
                <update>CAM_SHUTTERSPD</update>
                <update>CAM_ISO</update>
                <update>CAM_EV</update>
            </updates>            
            <options >
                <option name="Manual" value="2">
                    <exclusions>
                        <exclude>CAM_EV</exclude>
                    </exclusions>
                </option>
                <option name="Auto" value="1">
                    <exclusions>
                        <exclude>CAM_ISO</exclude>
                        <exclude>CAM_SHUTTERSPD</exclude>
                    </exclusions>				
                </option>
            </options>
        </parameter>  
        <parameter name="CAM_SHUTTERSPD" type="float" default=".033">
            <description>Shutter Speed</description>
            <options>
                <option name="1" value="1" />
                <option name="1/2" value=".5" />
                <option name="1/4" value=".25" />
                <option name="1/8" value=".125" />
                <option name="1/15" value=".066" />
                <option name="1/30" value=".033" />
                <option name="1/60" value=".016" />
                <option name="1/125" value=".008" />
                <option name="1/250" value=".004" />
                <option name="1/500" value=".002" />
                <option name="1/1000" value=".001" />
                <option name="1/2000" value=".0005" />
                <option name="1/5000" value=".00025" />
                <option name="1/10000" value=".00001" />
            </options>
        </parameter>
        <parameter name="CAM_ISO" type="uint32" default="400">
            <description>ISO</description>
            <options>
                <option name="10" value="10" />
                <option name="50" value="50" />
                <option name="100" value="100" />
                <option name="150" value="150" />
                <option name="200" value="200" />
                <option name="300" value="300" />
                <option name="400" value="400" />
                <option name="500" value="500" />
                <option name="600" value="600" />
                <option name="800" value="800" />
                <option name="1000" value="1000" />
                <option name="1200" value="1200" />
                <option name="1400" value="1400" />
                <option name="1600" value="1600" />
                <option name="2000" value="2000" />
                <option name="2400" value="2400" />
                <option name="2800" value="2800" />
                <option name="3200" value="3200" />                
            </options>
        </parameter>
        <parameter name="CAM_EV" type="float" default="0">
            <description>Exposure Compensation</description>
            <options>
                <option name="-3" value="-3" />
                <option name="-2.5" value="-2.5" />
                <option name="-2" value="-2" />
                <option name="-1.5" value="-1.5" />
                <option name="-1" value="-1" />
                <option name="-0.5" value="-0.5" />
                <option name="0" value="0" />
                <option name="+0.5" value="0.5" />
                <option name="+1" value="1" />
                <option name="+1.5" value="1.5" />
                <option name="+2" value="2" />
                <option name="+2.5" value="2.5" />
                <option name="+3" value="3" />
            </options>
        </parameter>
    </parameters>
</mavlinkcamera>

and here is the other,

<?xml version="1.0" encoding="UTF-8" ?>
<mavlinkcamera>
    <definition version="21">
        <model>Greenseer IR v1.0</model>
        <vendor>XXXXXXXXXXXXXXXXXXXXX</vendor>
    </definition>
    <parameters>
        <!-- control = 0 tells us this should not create an automatic UI control -->
        <parameter name="CAM_MODE" type="uint8" default="1" control="0">
            <description>Camera Mode</description>
            <!-- This tells us when this parameter changes, these parameters must be updated (requested)-->
            <options>
                <option name="Photo" value="0">
                    <!-- This tells us when Camera Mode is set to Photo mode, the following parameters should be ignored (hidden from UI or disabled)-->
                    <exclusions>
                        <exclude>CAM_PHOTOFMT</exclude>
                        <exclude>CAM_PHOTOQUAL</exclude>
                        <exclude>CAM_VIDFMT</exclude>
                        <exclude>CAM_COLORMODE</exclude>
                        <exclude>CAM_ISO</exclude>
                        <exclude>CAM_WBMODE</exclude>
                        <exclude>CAM_EXPMODE</exclude>
                        <exclude>CAM_SHUTTERSPD</exclude>
                        <exclude>CAM_ISO</exclude>
                        <exclude>CAM_EV</exclude>
                        <exclude>CAM_VIDRES</exclude>
                    </exclusions>
                </option>
                <option name="Video" value="1">
                    <!-- Conversely, when Camera Mode is set to Photo mode, the following parameters should be ignored (hidden from UI or disabled)-->
                    <exclusions>
                        <exclude>CAM_PHOTOFMT</exclude>
                        <exclude>CAM_PHOTOQUAL</exclude>
                        <exclude>CAM_VIDFMT</exclude>
                        <exclude>CAM_COLORMODE</exclude>
                        <exclude>CAM_ISO</exclude>
                        <exclude>CAM_WBMODE</exclude>
                        <exclude>CAM_EXPMODE</exclude>
                        <exclude>CAM_SHUTTERSPD</exclude>
                        <exclude>CAM_ISO</exclude>
                        <exclude>CAM_EV</exclude>
                        <exclude>CAM_VIDRES</exclude>
                    </exclusions>
                </option>
            </options>
        </parameter>
        <parameter name="CAM_COLORPAL" type="uint32" default="0">
            <description>Color Palette</description>
            <options>
                <option name="White hot"    value="0" />
                <option name="Black hot"    value="1" />
                <option name="Spectra"      value="2" />
                <option name="Prism"        value="3" />
                <option name="Tyrian"       value="4" />
                <option name="Iron"         value="5" />
                <option name="Amber"        value="6" />
                <option name="Hi"           value="7" />
                <option name="Green"        value="8" />
            </options>
        </parameter>
        <parameter name="CAM_AGCMODE" type="uint32" default="1">
            <description>AGC Mode</description>
            <options>
                <option name="Linear"     value="1" />
                <option name="Histogram"  value="2" />
            </options>
        </parameter>
    </parameters>
</mavlinkcamera>

@julianoes
Copy link
Contributor

This doesn't look right:

03-14 08:59:28.011  5974  6729 W Mavsdk  : Trying to compare different types.
03-14 08:59:28.011  5974  6729 W Mavsdk  : Comparison type mismatch between uint8_t and float
03-14 08:59:28.011  5974  6729 W Mavsdk  : Trying to compare different types.
03-14 08:59:28.011  5974  6729 W Mavsdk  : Comparison type mismatch between uint8_t and float
03-14 08:59:28.011  5974  6729 W Mavsdk  : Trying to compare different types.
03-14 08:59:28.011  5974  6729 W Mavsdk  : Comparison type mismatch between uint8_t and float
03-14 08:59:28.011  5974  6729 W Mavsdk  : Trying to compare different types.
03-14 08:59:28.011  5974  6729 W Mavsdk  : Comparison type mismatch between uint8_t and uint32_t
03-14 08:59:28.011  5974  6729 W Mavsdk  : Trying to compare different types.
03-14 08:59:28.011  5974  6729 W Mavsdk  : Comparison type mismatch between uint8_t and uint32_t
03-14 08:59:28.011  5974  6729 W Mavsdk  : Trying to compare different types.

Given that the xml looks correct, presumably the type set in param_get_ext or param_set_ext is not correctly set by the camera implementation. Can you check that part?

@rayw-dronesense
Copy link
Author

Hi @julianoes ,

Unfortunately we don't have access to the source code for the drone.

What we do know is, the same logic and drone works using the mavsdk-server-android 1.3.2

@julianoes
Copy link
Contributor

julianoes commented Mar 18, 2024

Right, so it could also be a mavsdk regression then... 🤔

I guess we need to add a bunch of debug output and then try that.

Are you compiling mavsdk_server yourself? In which case you could add some debug things around where std::stoul happens. Otherwise, I need to make a release for it...

@rayw-dronesense
Copy link
Author

rayw-dronesense commented Mar 19, 2024

Are you compiling mavsdk_server yourself?

@julianoes - Nope, this was repro'd with the latest artifacts published on maven.

@julianoes
Copy link
Contributor

Right, well, I need to put this on my todo list. If it's urgent to you, consider github sponsoring.

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

3 participants