[GH-ISSUE #733] [BUG] received file content is wrong #2385

Open
opened 2026-03-15 20:19:10 +03:00 by kerem · 1 comment
Owner

Originally created by @springswen on GitHub (Sep 6, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/733

Originally assigned to: @hibiken on GitHub.

Sending a zip compressed package is about 1M, but the data received is more than 2M.

buf := new(bytes.Buffer)
_, err := io.Copy(buf , file)

task, err := tasktype.NewFileNotifyTask(&tasktype.FileNotifyPayload{
Scene:    scene,
Filename: handler.Filename,
Size:     handler.Size,
Content:  buf.String(),
})

func NewFileNotifyTask(in *FileNotifyPayload) (*asynq.Task, error) {
	payload, err := json.Marshal(in)
	if err != nil {
		return nil, err
	}
	return asynq.NewTask(MsgFileNotify, payload), nil
}

AsynqClient.EnqueueContext(ctx, task)

result:
send "File Size: 1133544"

receive: contentLen=2107718

Originally created by @springswen on GitHub (Sep 6, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/733 Originally assigned to: @hibiken on GitHub. Sending a zip compressed package is about 1M, but the data received is more than 2M. ```go buf := new(bytes.Buffer) _, err := io.Copy(buf , file) task, err := tasktype.NewFileNotifyTask(&tasktype.FileNotifyPayload{ Scene: scene, Filename: handler.Filename, Size: handler.Size, Content: buf.String(), }) func NewFileNotifyTask(in *FileNotifyPayload) (*asynq.Task, error) { payload, err := json.Marshal(in) if err != nil { return nil, err } return asynq.NewTask(MsgFileNotify, payload), nil } AsynqClient.EnqueueContext(ctx, task) ``` result: send "File Size: 1133544" receive: contentLen=2107718
Author
Owner

@kamikazechaser commented on GitHub (Sep 6, 2023):

I assume the data is also corrupted?

Does it remain the same if you unmarshal it without enqueuing to Redis?

<!-- gh-comment-id:1707767767 --> @kamikazechaser commented on GitHub (Sep 6, 2023): I assume the data is also corrupted? Does it remain the same if you unmarshal it without enqueuing to Redis?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#2385
No description provided.