Skip to content

sntp.sync in progress #3044

Closed
Closed
@danjohn

Description

@danjohn

Actual behavior

Calling sntp.sync() breaks the box, issuing "PANIC: unprotected error in call to Lua API (samwere.lua:87: sync in progress)"

Expected behavior

It's fine, that smtp.sync() observes an ongoing time sync attempt, but should keep calm (and maybe return an error), but definitely should not panic (+restart the device)!

More complicating, there is no way(?) to find out if there is a sync on the way (there are several async code paths in that very project), other than try&crash. Not very deterministic.

One more complicating, even the suggested pcall(sync) freaks out the same way (how can that occur?)

Test code

sntp.sync()
xpcall(sntp.sync(nil, function() print"synced" end, nil), nil)

NodeMCU startup banner

NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
	branch: master
	commit: 310faf7fcc9130a296f7f17021d48c6d717f5fb6
	release: 3.0-master_20190907
	release DTS: 201909070945
	SSL: true
	build type: float
	LFS: 0x20000
	modules: adc,coap,cron,crypto,dht,file,gpio,http,mdns,net,node,perf,rtcfifo,rtctime,sjson,sntp,tmr,uart,wifi,tls
 build 2019-09-23 05:80 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions