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

Potential issues with Elixir 1.9 or Nerves 1.5 #2

Closed
lawik opened this issue Jul 22, 2019 · 9 comments
Closed

Potential issues with Elixir 1.9 or Nerves 1.5 #2

lawik opened this issue Jul 22, 2019 · 9 comments

Comments

@lawik
Copy link

lawik commented Jul 22, 2019

I had a user get in touch about some issues with our Inky scenic driver which uses this where this module would end up sending a crash message because the port crashed.

I haven't confirmed that this is related to the updates but I figured I'd give a heads up in case you have something off of the top of your head about what might cause such an issue. Otherwise I'll follow up if I get more info.

I received this log:

00:00:52.489 [error] Jan  1 00:00:52 rpi_fb_capture: Unable to open primary display

00:00:52.496 [error] GenServer #PID<0.1566.0> terminating
** (stop) bad return value: {:stop, :port_crashed}
Last message: {#Port<0.187>, {:exit_status, 1}}
State: %RpiFbCapture.State{display_height: 0, display_id: 0, display_width: 0, height: 104, port: #Port<0.187>, request: {{#PID<0.1563.0>, #Reference<0.1665486460.268435457.243310>}, :rgb24}, width: 212}

00:00:52.503 [error] GenServer #PID<0.1563.0> terminating
** (MatchError) no match of right hand side value: {:error, :port_crashed}
    (scenic_driver_inky) lib/scenic_driver_inky.ex:90: ScenicDriverInky.handle_info/2
    (scenic) lib/scenic/view_port/driver.ex:215: Scenic.ViewPort.Driver.handle_info/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :capture
State: %{driver_module: ScenicDriverInky, driver_state: %{cap: #PID<0.1566.0>, color_affinity: :low, color_high: 180, color_low: 75, dithering: false, inky_pid: #PID<0.1565.0>, interval: 1000, last_crc: -1, size: {212, 104}, viewport: #PID<0.1548.0>}, viewport: #PID<0.1548.0>}

00:00:52.512 [error] GenServer #PID<0.1564.0> terminating
** (stop) bad return value: {:stop, :port_crashed}
Last message: {:EXIT, #PID<0.1563.0>, {:bad_return_value, {:stop, :port_crashed}}}
State: %{driver_module: Scenic.Driver.Nerves.Rpi, driver_state: %{clear_color: {0, 0, 0, 255}, closing: false, currently_drawing: [], debounce: %{}, dirty_graphs: [], dl_block_size: 128, dl_map: %{}, draw_busy: false, end_dl: nil, fonts: %{}, inputs: 0, last_used_dl: nil, pending_flush: false, port: #Port<0.186>, ready: false, root_ref: nil, screen_factor: 1.0, start_dl: nil, sync_interval: 15, textures: %{}, used_dls: %{}, viewport: #PID<0.1548.0>}, viewport: #PID<0.1548.0>}
@fhunleth
Copy link
Collaborator

That's not good. The display width and height look suspicious in the log messages. Maybe a clue?

@lawik
Copy link
Author

lawik commented Jul 25, 2019

I got a minimal test-case that seems to confirm it as part of 1.8 -> 1.9 or OTP 21 to 22.
pappersverk/scenic_driver_inky#3
I'll take a deeper look if I have a chance.

@lawik
Copy link
Author

lawik commented Jul 25, 2019

Clean nerves-project on Erlang 22.0 and Elixir 1.9 OTP 22.

Just added the RpiFbCapture dependency and then I just pushed the firmware and ran from iex:

iex(nerves_hello@nerves.local)1> {:ok, cap} = RpiFbCapture.start_link(width: 5, height: 5, display: 0)
{:ok, #PID<0.1030.0>}
** (EXIT from #PID<0.1028.0>) shell process exited with reason: bad return value: {:stop, :port_crashed}

@lawik
Copy link
Author

lawik commented Jul 25, 2019

Ah, RingLogger gave me a bit more story:

00:01:02.000 [error] Jan  1 00:01:01 rpi_fb_capture: Unable to open primary display

@fhunleth
Copy link
Collaborator

fhunleth commented Jul 25, 2019

I can reproduce. I've narrowed it down to the rpi-firmware version update from https://github.com/raspberrypi/firmware. Cherry-picking through releases now...

@fhunleth
Copy link
Collaborator

This is the commit that where I start getting "Unable to open primary display": raspberrypi/firmware@64b5649.

It could be that there's some setting or something that we need to do now.

@fhunleth
Copy link
Collaborator

Apparently it works better with the latest: raspberrypi/firmware@38e81f2. The "Unable to open primary display" message goes away. There's a scenic error with no info for me now - may be unrelated.

fhunleth added a commit to nerves-project/nerves_system_br that referenced this issue Jul 25, 2019
This fixes an error from vc_dispmanx_display_open. See
pappersverk/rpi_fb_capture#2 for details.
@fhunleth
Copy link
Collaborator

fhunleth commented Jul 25, 2019

Ok, things seem to work. After a clean build the scenic error went away.

I made a nerves_system_br update (v1.8.5) with the fix. You can create a custom nerves_system_rpi0 and bump the version of nerves_system_br in it to get the fix. Or you can wait. I think that it will take a day or two to get new official system releases out.

@lawik
Copy link
Author

lawik commented Jul 26, 2019

I'll wait for the release. Good job :)

@fhunleth fhunleth closed this as completed Nov 3, 2019
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