VNC / problems on start-up
lunanigra opened this issue · comments
Hello, I've added a VNC module to the 32c3 package.
There is a strange effect when starting info-beamer as service. The connection to the VNC server fails on start-up of the Raspberry Pi. If starting the info-beamer service later VNC connection works fine.
Any idea what may go wrong? Or any idea how to handle this start-up issue, e.g. wait until network connections are established before starting the info-beamer service?
Couldn't you use the :alive method for checking if the VNC connection is still up and then trying to reestablish the connection if it's down?
Sounds good; perhaps I do not find the right position for this check and reconnection.
But from my understanding the VNC connection is already established on every schedule inside the run method, isn't it?
local utils = require "utils"
local M = {}
function M.can_schedule()
return true
end
function M.prepare(options)
return options.duration, options.server
end
function M.run(duration, server, fn)
local E = duration
local x = utils.make_smooth{
{t = 0, val = 600},
{t = 1, val = 50},
{t = E-1, val = 50},
{t = E, val = -1000},
}
local y = utils.make_smooth{
{t = 0, val = 300},
{t = 1, val = 0},
{t = E-1, val = 20},
{t = E, val = 900},
}
local rotate = utils.make_smooth{
{t = 0, val = 90},
{t = 1, val = -10},
{t = 2, val = -10},
{t = E-1, val = -5},
{t = E, val = -180},
}
local scale = utils.make_smooth{
{t = 0, val = 0},
{t = 1, val = 0.94},
{t = E-1, val = 0.90},
{t = E, val = 0},
}
local vnc = resource.create_vnc(server)
fn.wait_t(0)
Sidebar.hide(duration-1)
-- Fadeout.fade(duration-1)
for now in fn.upto_t(duration) do
-- vnc:draw(0, 0, WIDTH, HEIGHT)
gl.pushMatrix()
gl.rotate(rotate(now), 0, 1, 0)
gl.translate(x(now), y(now))
local scale = scale(now)
util.draw_correct(vnc, 0, 0, WIDTH*scale, HEIGHT*scale)
gl.popMatrix()
end
vnc:dispose()
return true
end
return M
That is correct. It will try to establish a connection each time it is scheduled. And this doesn't work if the network wasn't up when info-beamer started? Seems odd. The vnc code is basically the same since 2013 and is basically identical to the open source code. Can you try to build a minimal example that also has this problem, then try to strace it?
I checked the log - seems to be something with the DNS cache.
VNC connection fails. Even updating the playlist.json does not solve this issue. Hosename gets updates; but still DNS error.
Jul 11 17:48:26 infobeamer infobeamer: #033[33m[vnc@jessie:5900]#033[0m dns error: non-recoverable failure in name resolution
Jul 11 17:48:26 infobeamer infobeamer: #033[33m[vnc@jessie:5900]#033[0m connection closed
After stopping and starting the service everything works fine...
Jul 11 17:50:31 infobeamer infobeamer: #033[33m[vnc@jessiet:5900]#033[0m connecting...
Jul 11 17:50:32 infobeamer infobeamer: #033[33m[vnc@jessie:5900]#033[0m connected!
Jul 11 17:50:32 infobeamer infobeamer: #033[33m[vnc@jessie:5900]#033[0m got screen: 1920x1200
Interesting observation. I guess the dns client implementation of libevent statically initializes the dns servers from an empty/invalid /etc/resolv.conf
file and then never updates those if they change. I guess occasionally calling
int evdns_base_clear_nameservers_and_suspend(struct evdns_base *base);
int evdns_base_resume(struct evdns_base *base);
might help. I can look into this and will provide you with a new info-beamer version for testing soon.
You can download a new prerelease on https://info-beamer.com/download/player#prerelease. Let me know if that fixes this problem.
Thanks! I checked and first impression is that is works fine now. VNC session got established directly on reboot.