Closed joeshaw closed 2 years ago
As a curious user considering migrating from xbar, can I ask: when it crashes, do the icons disappear from your menubar (i.e. SwiftBar is completely gone/stopped) or is it just that it stops updating?
I'm asking because I'm motivated to move by xbar issue #714 ("Crashing after a large number of refreshes") and there's no point migrating if the same behaviour occurs here!
I'd be surprised if it is the same error, but wanted to check. š
@gimbo It crashes and the items leave the menubar.
An older version (1.4.1 iirc) had an issue where items stopped updating, but that was fixed and I haven't had any problems with updating since.
I'm trying to catch this in a debug session, I've been running 3 simple plugins with 5s refresh period for a week and a half now... no luck.
I'll try to have more complex plugins and somehow trigger sleep-wake. Stay tuned...
@joeshaw can you share with me any of your plugins?
So far SwiftBar is solid for me, with two caveats:
Similar experience here - two SIGSEGV crashes this week, on 1.4.3 (422), on M1 running 12.4.
@bobobox plz give me an example plugin, I can't catch this
I run 3, but I can only give you two of them.
utc.5s.bash
#!/bin/bash
exec date -u +':globe: %H:%M | size=13'
stock-ticker.30s.
-- This is a Go program. I'm including the source below but if you want me to attach a binary instead I can do that. If you have go installed, drop it in a directory and run go build -o stock-ticker.30s. .
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
type result struct {
Chart struct {
Result []struct {
Meta struct {
Symbol string `json:"symbol"`
Price float64 `json:"regularMarketPrice"`
PrevPrice float64 `json:"chartPreviousClose"`
} `json:"meta"`
} `json:"result"`
} `json:"chart"`
}
const urlFmt = "https://query1.finance.yahoo.com/v7/finance/chart/%s?interval=1d"
func main() {
symbols := []string{"AAPL", "^SPX"}
for i, s := range symbols {
u := fmt.Sprintf(urlFmt, s)
resp, err := http.Get(u)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
if resp.StatusCode != http.StatusOK {
log.Fatalf("%d: %s", resp.StatusCode, body)
}
var r result
if err := json.Unmarshal(body, &r); err != nil {
log.Fatalf("%v: %s", err, body)
}
price := r.Chart.Result[0].Meta.Price
prev := r.Chart.Result[0].Meta.PrevPrice
net := price - prev
pct := net / prev * 100
var arrow string
if net > 0 {
arrow = "ā"
} else if net < 0 {
arrow = "ā"
}
if i == 0 {
fmt.Printf("%s $%.2f%s | size=13\n", s, price, arrow)
fmt.Println("---")
}
fmt.Printf("%s %.2f %+.2f (%+.2f%%)\n", s, price, net, pct)
}
}
The third is another Go program that runs every 5s. Unfortunately I can't share that one.
@joeshaw hey, I think I'm ready to give up...
I've been running these two plugins on two different machines(Intel and M1) for two weeks straight, with at least 20 sleep-wake cycle on both of them. It just works.š¤·āāļø
@melonamin Is there anything more I can do to help? A debugging build, additional logs, anything like that?
I appreciate your effort trying to reproduce it so far.
Iām researching how to add a better crash reporting at the moment
@joeshaw I've added crash reportiing, please try running this build SwiftBar.1.4.4b448.zip
Just as an FYI, I've been running this build for about a week now without any crashes. I'll update if and when I see one.
Hey @adamkdean, since you are expiriencing a simmilar issue in xbar, I would love you to take this build of SwiftBar for a spin.
@melonamin once I'm done with testing xbar, I'll give SwiftBar a whirl too and get back to you
@joeshaw please tell me it's been rock solid for you all this time, I want to release 1.4.4 soon-ish
@melonamin No issues here. I feel comfortable with it, and I think you can probably close this issue now. I'll reopen it or file another if I start seeing the issue again. I'm sorry we couldn't precisely identify it!
Describe the bug I have been seeing SwiftBar crashes (either SIGSEGV or SIGABRT) due to memory corruption.
I haven't been able to detect a consistent pattern with the crashes. They seem to happen every couple of days, typically after I've put my machine to sleep. They seem to happen when my machine does a macOS "power nap" wakeup, though I am not certain on that.
I'm attaching 3 crash reports to the bug. Two are segfaults (SIGSEGV) and one is a SIGABRT triggered by
malloc()
detecting heap corruption.Environment:
Additional Context:
I have 3 scripts running:
I do run Bartender. I have not (yet) tried running without it, though I previously ran earlier 1.4.x versions under it without issue.
I've attached the crash reports generated my macOS below. GitHub did not like the original
ips
extension, so I appended.txt
to them. They are JSON files, however, but can be rendered more prettily by Console.app.SwiftBar-2022-05-05-191332.ips.txt SwiftBar-2022-05-06-165801.ips.txt SwiftBar-2022-05-11-205124.ips.txt