各位大神,本人在Android环境使用FTPClient下载文件,之前使用RandomAccessfile进行多线程并发写入,速率较慢,百度一番后使用Mappedbytebuffer,但是有时报 Fatal signal 7 (SIGBUS) at 0x7cc73000 (code=2)错误会直接中断APP,希望大神给予帮助,我的代码中没有操作C/C++,不知道如何实现对齐访问,恳请指点,谢谢
报错的Logcat如下:
12-05 16:24:16.850 10110-10279/com.ftp.instant A/libc: Fatal signal 7 (SIGBUS) at 0x7cc73000 (code=2), thread 10279 (Thread-161)
12-05 16:24:16.950 155-155/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-05 16:24:16.950 155-155/? I/DEBUG: Build fingerprint: 'Android/samsung/samsung:4.4.2/KOT49H/3.7.3.1019:userdebug/test-keys'
12-05 16:24:16.950 155-155/? I/DEBUG: Revision: '0'
12-05 16:24:16.950 155-155/? I/DEBUG: pid: 10110, tid: 10279, name: Thread-161 >>> com.ftp.instant <<<
12-05 16:24:16.950 155-155/? I/DEBUG: signal 7 (SIGBUS), code 2 (BUS_ADRERR), fault addr 7cc73000
12-05 16:24:16.990 155-155/? I/DEBUG: backtrace:
12-05 16:24:16.990 155-155/? I/DEBUG: #00 pc 0003e54a /system/lib/libc.so
12-05 16:24:16.990 155-155/? I/DEBUG: stack:
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7924 00000410
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7928 00000080
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c792c b4ddba92 /system/lib/libdvm.so
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7930 b4ecacb0 /system/lib/libdvm.so
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7934 24b00005
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7938 00000400
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c793c b4d68669 /system/lib/libdvm.so
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7940 b8f7f908 [heap]
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7944 24b00005
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7948 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c794c 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7950 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7954 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7958 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c795c b4ecacb0 /system/lib/libdvm.so
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7960 b8f7f860 [heap]
12-05 16:24:16.990 155-155/? I/DEBUG: #00 7d0c7964 00000400
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7968 b8f7f860 [heap]
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c796c b4d6a70f /system/lib/libdvm.so
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7970 7cc72d54 /storage/emulated/0/ftptmp/ftp5m
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7974 9515dd4c /dev/ashmem/dalvik-heap (deleted)
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7978 00000400
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c797c 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7980 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7984 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7988 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c798c 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7990 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7994 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c7998 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c799c 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: 7d0c79a0 00000000
12-05 16:24:16.990 155-155/? I/DEBUG: memory map around fault addr 7cc73000:
12-05 16:24:16.990 155-155/? I/DEBUG: 7cac6000-7cc72000 rw- /storage/emulated/0/ftptmp/ftp5m
12-05 16:24:16.990 155-155/? I/DEBUG: 7cc72000-7ce1d000 rw- /storage/emulated/0/ftptmp/ftp5m
12-05 16:24:16.990 155-155/? I/DEBUG: 7ce1d000-7cfc8000 rw- /storage/emulated/0/ftptmp/ftp5m
12-05 16:24:17.040 475-498/system_process I/BootReceiver: Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
12-05 16:24:17.040 475-10284/system_process W/ActivityManager: Force finishing activity com.ftp.instant/.MainActivity
12-05 16:24:17.050 475-514/system_process W/InputDispatcher: channel '4a99005c com.ftp.instant/com.ftp.instant.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
12-05 16:24:17.050 475-514/system_process E/InputDispatcher: channel '4a99005c com.ftp.instant/com.ftp.instant.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-05 16:24:17.070 475-498/system_process D/dalvikvm: GC_FOR_ALLOC freed 654K, 18% free 9730K/11784K, paused 30ms, total 31ms
12-05 16:24:17.080 475-486/system_process W/InputDispatcher: Attempted to unregister already unregistered input channel '4a99005c com.ftp.instant/com.ftp.instant.MainActivity (server)'
12-05 16:24:17.080 475-486/system_process I/WindowState: WIN DEATH: Window{4a99005c u0 com.ftp.instant/com.ftp.instant.MainActivity}
代码在楼下贴出