LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2022, 07:02 AM   #1
Vnegi
LQ Newbie
 
Registered: Feb 2022
Posts: 2

Rep: Reputation: 0
CIFS: read block indefinitely for file on CIFS and Samba


Our on production system we have mounted the Azure file share using the CIFS (using Kubernetes).

For certain files, we see our program block on reading indefinitely. Our application stack is golang. Hence sharing the golang script.

A sample script to read the affected file 10 bytes at a time eventual hang

Code:
package main
import (
    "fmt"
    "io"
    "os"
    "time"
)
func main() {
    handler, err := os.Open(os.Args[1])
    if err != nil {
        panic(err)
    }
    defer func() {
        err := handler.Close()
        fmt.Println("Error", err)
    }()
    var totalBytes int64
    var totalCounter int64 = 0
    for {
        d := make([]byte, 10)
        // bufio.NewReader(handler).Read
        // 2147483647
        // 3461194000
        n, err := handler.Read(d)
        if err != nil && err != io.EOF {
            panic(err)
        }
        if err == io.EOF {
            fmt.Println("EOF received")
            break
        }
        totalBytes += int64(n)
        if (n != 0) && (totalCounter%10000000) == 0 {
            kb := totalBytes / 1024
            mb := kb / 1024
            gb := mb / 1024
            fmt.Println(time.Now())
            fmt.Printf("%d %d %d %d %d\n", totalCounter, totalBytes, kb, mb, gb)
            totalCounter = 0
        }
        totalCounter++
        if (totalBytes / 1024) >= 3461180 {
            fmt.Printf("%s\n", d)
        }
    }
}
We have are read blocked on certain files indefinitely as if the EOF was never seen.

Here the stack trace obtained after SIGSEGV was triggered

Quote:
SIGSEGV: segmentation violation
PC=0x45d1e1 m=0 sigcode=0
goroutine 0 [idle]:
runtime.futex()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/sys_linux_amd64.s:519 +0x21
runtime.futexsleep(0xc000022000, 0xdbbbfe30, 0x421831)
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/os_linux.go:44 +0x36
runtime.notesleep(0x53ccb0)
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/lock_futex.go:160 +0x87
runtime.mPark()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/proc.go:1441 +0x2a
runtime.stopm()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/proc.go:2408 +0x78
runtime.findrunnable()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/proc.go:2984 +0x865
runtime.schedule()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/proc.go:3367 +0x239
runtime.park_m(0xc000001380)
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/proc.go:3516 +0x14d
runtime.mcall()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/asm_amd64.s:307 +0x43
goroutine 1 [syscall, 40 minutes]:
syscall.Syscall(0x0, 0x3, 0xc000256430, 0xa)
/usr/local/Cellar/go/1.17.2/libexec/src/syscall/asm_linux_amd64.s:20 +0x5
syscall.read(0xc0000b6120, {0xc000256430, 0x7f6604197ce0, 0x5})
/usr/local/Cellar/go/1.17.2/libexec/src/syscall/zsyscall_linux_amd64.go:687 +0x4d
syscall.Read(...)
/usr/local/Cellar/go/1.17.2/libexec/src/syscall/syscall_unix.go:189
internal/poll.ignoringEINTRIO(...)
/usr/local/Cellar/go/1.17.2/libexec/src/internal/poll/fd_unix.go:582
internal/poll.(*FD).Read(0xc0000b6120, {0xc000256430, 0xa, 0xa})
/usr/local/Cellar/go/1.17.2/libexec/src/internal/poll/fd_unix.go:163 +0x285
os.(*File).read(...)
/usr/local/Cellar/go/1.17.2/libexec/src/os/file_posix.go:32
os.(*File).Read(0xc0000b4018, {0xc000256430, 0xa, 0xa})
/usr/local/Cellar/go/1.17.2/libexec/src/os/file.go:119 +0x5e
main.main()
/Users/admin/Documents/goProject/src/github.com/ringsq/detech-eof.go:22 +0xb6
 
Old 02-03-2022, 02:09 PM   #2
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
This sounds like a corrupted file.
I would first suggest idling that drive (dismount it or boot from live media to leave it dismounted) then run fsck to see what errors may exist and if that file can be fixed.
Once the file is fixed then the system can be brought back up.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CIFS: read block indefinitely for file Vnegi Linux - General 1 02-03-2022 01:54 PM
[SOLVED] Will adding 'testing' to sources.list file keep my Debian installing rolling indefinitely? linustalman Debian 9 02-24-2017 08:47 AM
[SOLVED] Simple read line_ function hangs indefinitely andrew.comly Programming 11 07-11-2016 05:45 AM
How do I pause a thread indefinitely and then resume it again (in Java)? Nylex Programming 7 02-18-2007 12:13 PM
logrotate takes up 100% CPU indefinitely BroX Slackware 2 05-24-2005 03:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration