Navigation Menu

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

Bus error on Raspberry Pi 2 armv7 command line app #22384

Closed
DartBot opened this issue Feb 11, 2015 · 9 comments
Closed

Bus error on Raspberry Pi 2 armv7 command line app #22384

DartBot opened this issue Feb 11, 2015 · 9 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.

Comments

@DartBot
Copy link

DartBot commented Feb 11, 2015

This issue was originally filed by sim...@jseb.com


What steps will reproduce the problem?

  1. run dart file on command line with timezone pub package.
     
    import 'package:timezone/standalone.dart';

main() {
  print("detroit time");
  initializeTimeZone().then((_) {
    final detroit = getLocation('America/Detroit');
    final now = new TZDateTime.now(detroit);
    print("detroit time is $now");
  });
}

What is the expected output? What do you see instead?
Expected Result, on Intel cpu

detroit time
detroit time is 2015-02-11 18:09:25.986-0500

Failed Result, on Raspberry Pi 2 armv7

detroit time
Bus error

What version of the product are you using?
Dart VM version: 1.9.0-edge.43675 (Wed Feb 11 16:14:19 2015) on "linux_arm"

On what operating system?
Debian raspbian jessie
uname -a
Linux raspberrypi 3.18.5-v7+ #­225 SMP PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7l GNU/Linux

What browser (if applicable)?
N/A command line app

Please provide any additional information below.
Linux dmesg command after bus error
[36831.772850] Alignment trap: not handling instruction ed930b00 at [<0068ccd8>]
[36831.772882] Unhandled fault: alignment exception (0x001) at 0xb5534789

@zanderso
Copy link
Member

There are a number of reasons this could be happening. We'll have to narrow it down. If possible, we can get the best information if you can run a Debug build of the VM under gdb, and get a stack trace for the crash. If the stack trace looks reasonable, we're probably not passing the right flags to the compiler for this ARM CPU, or we could also need a different cross-compiler entirely.

gdb may also be confused at this point. This indicates the crash is happening in generated code. In that case, it can be useful to disassemble the code at the point of the crash.

In either of these cases, it can also be useful to have the address whose access caused the crash.

If you have time to track down this information that would be a big help. If not, one of us will probably grab a Pi2 and try to get things working eventually.

Thanks for the bug report!


Set owner to @zanderso.
Removed Priority-Unassigned label.
Added Priority-Low, Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Feb 15, 2015

This comment was originally written by la...@gmail.com


Same thing happens on my Pi2 when sending the first command to the mongod server. This happened on the older Model B, too. And also with older dartlang versions (I tried 1.8.0).

@iposva-google
Copy link
Contributor

Added Accepted label.

@iposva-google
Copy link
Contributor

From http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html

Further, unaligned accesses are only allowed to regions marked as Normal memory type, and unaligned access support must be enabled by setting the SCTLR.A bit in the system control coprocessor. Attempts to perform unaligned accesses when not allowed will cause an alignment fault (data abort).

===

I am wondering whether the SCTLR.A bit is not set by the boot images being used here.

@DartBot
Copy link
Author

DartBot commented Feb 20, 2015

This comment was originally written by laeu...@gmail.com


From what I heard (maybe the presentation press conference https://www.youtube.com/watch?v=My4iAv5b_ts), the RPi2, even though ARMv7, is configured to behave just like the older models (ARMv6 and hard float, IIRC), to be backwards compatible at least in user land. This should be the case at least when on the Raspbian image available for download. On the new (RPi2-only) Ubuntu image that may be different.

@DartBot
Copy link
Author

DartBot commented Apr 5, 2015

This comment was originally written by sim...@jseb.com


Update - So the issue is not urgent for me, just interested in timezone pub package.
Now getting stack trace with Dart VM version: 1.10.0-edge.44906, running linaro build Linux raspberry 3.18.10-v7+ #­774 SMP PREEMPT Wed Mar 25 14:10:30 GMT 2015 armv7l

Unhandled exception:
Uncaught Error: FormatException: Invalid value in input: 255
Stack Trace:
#­0 initializeTimeZone.<anonymous closure> (package:timezone/standalone.dart:97:5)
#­1 _RootZone.runUnary (dart:async/zone.dart:1155)
#­2 _Future._propagateToListeners.handleError (dart:async/future_impl.dart:525)
#­3 _Future._propagateToListeners (dart:async/future_impl.dart:580)
#­4 _Future._propagateToListeners.handleWhenCompleteCallback.<anonymous closure> (dart:async/future_impl.dart:560)
#­5 _RootZone.runUnary (dart:async/zone.dart:1155)
#­6 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#­7 _Future._propagateToListeners (dart:async/future_impl.dart:577)
#­8 _Future._completeWithValue (dart:async/future_impl.dart:368)
#­9 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:422)
#­10 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#­11 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#­12 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#­13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:143)

#­0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:886)
#­1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#­2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#­3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#­4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:143)

@zanderso
Copy link
Member

zanderso commented Apr 7, 2015

You can check alignment handling by doing:

$ cat /proc/cpu/alignment

This will show stats about unaligned accesses, and the last line will show what the kernel does with unaligned access traps.

I've been able to repro the failure in #­6 on both hardware and in our simulator. It appears there's a bug in optimizing typed data array accesses in Location.fromBytes in the timezone package. I will investigate further.


Removed Priority-Low label.
Added Priority-Medium label.

@DartBot
Copy link
Author

DartBot commented Apr 8, 2015

This comment was originally written by sim...@jseb.com


Cool, thanks just compiled and getting expected results now with
Dart VM version: 1.10.0-edge.44956 (Wed Apr 8 11:11:49 2015) on "linux_arm"

Seems the alignment is now being fixed on/by my raspberry pi 2, which must be causing the slow down compared to old AMD linux box, with the program taking around 5 seconds to run on pi 2 and around 0.5 seconds on ReleaseIA32/AMD.

Thanks for working on this, again extremely low priority for me, I wonder if alignment issue for other small arm devices running linux and or android.

More details

My default cat /proc/cpu/alignment has "User faults: 2 (fixup)"
When set alignment to "User faults: 3 (fixup+warn)" as root by
$ echo 3 > /proc/cpu/alignment
I am getting lots of traps , > 1200, in dmesg
Alignment trap: dart (6426) PC=0x0069dbf0 Instr=0xe18100d3 Address=0x751ff4bf FSR 0x001

@zanderso
Copy link
Member

zanderso commented Apr 8, 2015

Fixed by https://codereview.chromium.org/1068823004/ in r44955

The timezone package appears to rely on a data file containing lots of unaligned fields. Reading in and parsing this file is likely the source of the alignment traps and slowdown. Aligning the fields would probably improve performance on Intel, as well. It might be worthwhile filing a bug against the timezone package.

Thanks for reporting issue! Happy to have this bug fixed =)


Added Fixed label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. labels Apr 8, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

3 participants