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

BUG: meshviewer.json sometimes empty #236

Open
T0biii opened this issue May 28, 2024 · 4 comments
Open

BUG: meshviewer.json sometimes empty #236

T0biii opened this issue May 28, 2024 · 4 comments

Comments

@T0biii
Copy link

T0biii commented May 28, 2024

We(Freifunk MUC) got a couple of meshviewer.json files:
https://github.com/freifunkMUC/ffmuc-salt-public/blob/main/yanic/yanic.conf.tmpl#L45-L89
Sometimes some of them are empty the only way to get content back is to restart yanic (sometimes several times).
In the Logs there is no hint why the output is empty

@maurerle
Copy link
Contributor

I never experienced such a behavior in FFAC.
We are directly serving the meshviewer.json from the yanic running on the map server, and it never has been empty..?

@T0biii
Copy link
Author

T0biii commented May 28, 2024

we think it might be a problem with more than one meshviewer output
But atm we have no idea why this is happening sometimes

@genofire
Copy link
Member

without any setup / code / logs which make it reproducible we also have no idea how to solve this issue.

The code is designed, that we normaly write everything in a .tmp file and the move that to the correct place. On this way, the should to no time be a empty file.
See here for the code:

yanic/runtime/nodes.go

Lines 272 to 289 in ef3ee35

func SaveJSON(input interface{}, outputFile string) {
tmpFile := outputFile + ".tmp"
f, err := os.OpenFile(tmpFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
log.Panic(err)
}
err = json.NewEncoder(f).Encode(input)
if err != nil {
log.Panic(err)
}
f.Close()
if err := os.Rename(tmpFile, outputFile); err != nil {
log.Panic(err)
}
}

@T0biii
Copy link
Author

T0biii commented Jun 14, 2024

in the logs there seems no reasone why this is happening. After an restart it is fixed.
Can we add somewhere some more logging?

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

3 participants