tdl icon indicating copy to clipboard operation
tdl copied to clipboard

[Bug] panic: unaligned 64-bit atomic operation on 32-bit machine

Open YELLOWENTOURAGE opened this issue 1 year ago • 3 comments

Describe the bug

panic: unaligned 64-bit atomic operation on 32-bit machine on download since v0.17.3

Probably a gotd upstream bug introduced here since v0.103.0: https://github.com/gotd/td/blame/8b6a924ac78c277b58d22f32f4b7f3897d068299/telegram/client.go#L92

Not the first time breaking - see also: https://github.com/iyear/tdl/issues/14

To Reproduce

  1. tdl download ... on 32-bit machine (e.g. armv7)
  2. Panic

Expected behavior

Proceed with download

Version

Version: 0.17.3
Commit: 6c382b8
Date: 2024-07-07T10:59:56Z

go1.21.11 linux/arm

Which OS are you running tdl on?

Linux

Additional context

Log from v0.17.3 on linux/armv7

panic: unaligned 64-bit atomic operation

goroutine 12 [running]:
runtime/internal/atomic.panicUnaligned()
	runtime/internal/atomic/unaligned.go:8 +0x24
runtime/internal/atomic.Xadd64(0x3102a84, 0x1)
	runtime/internal/atomic/atomic_arm.s:258 +0x14
go.uber.org/atomic.(*Int64).Add(...)
	go.uber.org/[email protected]/int64.go:50
go.uber.org/atomic.(*Int64).Inc(...)
	go.uber.org/[email protected]/int64.go:60
github.com/gotd/td/telegram.(*Client).Pool.func1()
	github.com/gotd/[email protected]/telegram/pool.go:47 +0x3c
github.com/gotd/td/pool.(*DC).createConnection(0x31a84e0, 0x1)
	github.com/gotd/[email protected]/pool/pool.go:72 +0x20
github.com/gotd/td/pool.(*DC).acquire(0x31a84e0, {0x16806f0, 0x31aeb28})
	github.com/gotd/[email protected]/pool/pool.go:181 +0x1f4
github.com/gotd/td/pool.(*DC).Invoke(0x31a84e0, {0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/gotd/[email protected]/pool/pool.go:246 +0x74
github.com/gotd/contrib/middleware/floodwait.(*SimpleWaiter).Handle.func1({0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/gotd/[email protected]/middleware/floodwait/simple_waiter.go:77 +0x98
github.com/gotd/td/telegram.InvokeFunc.Invoke(0x31fa440, {0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/gotd/[email protected]/telegram/middleware.go:15 +0x4c
github.com/iyear/tdl/core/middlewares/retry.(*retry).Handle.retry.Handle.func1({0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/iyear/tdl/[email protected]/middlewares/retry/retry.go:36 +0xe8
github.com/gotd/td/telegram.InvokeFunc.Invoke(0x3187d60, {0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/gotd/[email protected]/telegram/middleware.go:15 +0x4c
github.com/iyear/tdl/core/middlewares/recovery.(*recovery).Handle.func1.1()
	github.com/iyear/tdl/[email protected]/middlewares/recovery/recovery.go:35 +0x5c
github.com/cenkalti/backoff/v4.RetryNotifyWithTimer.Operation.withEmptyData.func1()
	github.com/cenkalti/backoff/[email protected]/retry.go:18 +0x1c
github.com/cenkalti/backoff/v4.doRetryNotify[...](0x310d664, {0x167e528, 0x31a8480}, 0x310d69c, {0x0, 0x0})
	github.com/cenkalti/backoff/[email protected]/retry.go:88 +0xe8
github.com/cenkalti/backoff/v4.RetryNotifyWithTimer(0x310d6a4, {0x167e528, 0x31a8480}, 0x310d69c, {0x0, 0x0})
	github.com/cenkalti/backoff/[email protected]/retry.go:61 +0x6c
github.com/cenkalti/backoff/v4.RetryNotify(...)
	github.com/cenkalti/backoff/[email protected]/retry.go:49
github.com/iyear/tdl/core/middlewares/recovery.(*recovery).Handle.func1({0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/iyear/tdl/[email protected]/middlewares/recovery/recovery.go:34 +0xec
github.com/gotd/td/telegram.InvokeFunc.Invoke(0x31fa450, {0x16806f0, 0x31aeb28}, {0x167be3c, 0x31fa530}, {0x1679024, 0x31e83a8})
	github.com/gotd/[email protected]/telegram/middleware.go:15 +0x4c
github.com/gotd/td/tg.(*Client).ChannelsGetChannels(0x31e82e8, {0x16806f0, 0x31aeb28}, {0x31e83a0, 0x1, 0x1})
	github.com/gotd/[email protected]/tg/tl_channels_get_channels_gen.go:211 +0xc0
github.com/gotd/td/telegram/peers.(*Manager).updateChannel(0x3226300, {0x16806f0, 0x31aeb28}, {0x168b030, 0x323a020})
	github.com/gotd/[email protected]/telegram/peers/query.go:162 +0x80
github.com/gotd/td/telegram/peers.(*Manager).getChannel(0x3226300, {0x16806f0, 0x31aeb28}, {0x168b030, 0x323a020})
	github.com/gotd/[email protected]/telegram/peers/query.go:157 +0x284
github.com/gotd/td/telegram/peers.(*Manager).GetChannel(0x3226300, {0x16806f0, 0x31aeb28}, {0x168b030, 0x323a020})
	github.com/gotd/[email protected]/telegram/peers/channel.go:29 +0x3c
github.com/gotd/td/telegram/peers.(*Manager).ResolveChannelID(0x3226300, {0x16806f0, 0x31aeb28}, 0x64a4b417)
	github.com/gotd/[email protected]/telegram/peers/id.go:64 +0xd4
github.com/iyear/tdl/core/util/tutil.GetInputPeer({0x16806f0, 0x31aeb28}, 0x3226300, {0x3163f70, 0xa})
	github.com/iyear/tdl/[email protected]/util/tutil/tutil.go:104 +0xfc
github.com/iyear/tdl/pkg/tmessage.getChatInfo({0x16806f0, 0x31aeb28}, 0x31e82e8, {0x167f9b0, 0x300d960}, {0x1677d84, 0x31e82f0})
	github.com/iyear/tdl/pkg/tmessage/files.go:146 +0x23c
github.com/iyear/tdl/pkg/tmessage.parseFile({0x16806f0, 0x31aeb28}, 0x31e82e8, {0x167f9b0, 0x300d960}, {0x315ab40, 0x27}, 0x1)
	github.com/iyear/tdl/pkg/tmessage/files.go:68 +0xec
github.com/iyear/tdl/app/dl.Run.FromFile.func3()
	github.com/iyear/tdl/pkg/tmessage/files.go:44 +0x138
github.com/iyear/tdl/pkg/tmessage.Parse(...)
	github.com/iyear/tdl/pkg/tmessage/tmessage.go:15
github.com/iyear/tdl/app/dl.collectDialogs({0x310dc6c, 0x2, 0x2})
	github.com/iyear/tdl/app/dl/dl.go:132 +0x7c
github.com/iyear/tdl/app/dl.Run({0x16806f0, 0x31aeb28}, 0x3102840, {0x167f9b0, 0x300d960}, {{0xbe803dd4, 0xe}, 0x0, 0x1, {0xbe803d78, ...}, ...})
	github.com/iyear/tdl/app/dl/dl.go:65 +0x3a4
github.com/iyear/tdl/cmd.NewDownload.func1.1({0x1680710, 0x30f0e40}, 0x3102840, {0x167f9b0, 0x300d960})
	github.com/iyear/tdl/cmd/dl.go:33 +0x74
github.com/iyear/tdl/cmd.tRun.func1({0x1680710, 0x30f0e40})
	github.com/iyear/tdl/cmd/root.go:163 +0x48
github.com/iyear/tdl/cmd.tRun.RunWithAuth.func2({0x1680710, 0x30f0e40})
	github.com/iyear/tdl/[email protected]/tclient/tclient.go:120 +0x78
github.com/gotd/td/telegram.(*Client).Run.func3({0x1680710, 0x30f0e40})
	github.com/gotd/[email protected]/telegram/connect.go:150 +0xd0
github.com/gotd/td/telegram.(*Client).Run.(*CancellableGroup).Go.func6()
	github.com/gotd/[email protected]/tdsync/cancel_group.go:48 +0x34
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x60
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	golang.org/x/[email protected]/errgroup/errgroup.go:75 +0xa0

YELLOWENTOURAGE avatar Aug 07 '24 12:08 YELLOWENTOURAGE

I got the same error on the Odroid-XU4 (ARM7) with DietPi (Raspbian-like).

I downgraded to the previous version (0.17.2), and it works like a charm!

facundobianco avatar Sep 06 '24 03:09 facundobianco

I submitted https://github.com/gotd/td/pull/1442 to try to fix this issue.

iyear avatar Sep 17 '24 07:09 iyear

I've tagged gotd v0.110.1 with fix from submitted PR, thank you

ernado avatar Sep 17 '24 10:09 ernado

Try v0.17.5

iyear avatar Oct 03 '24 07:10 iyear