LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


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

Rep: Reputation: 0
CIFS: read block indefinitely for file


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, 01:54 PM   #2
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

https://www.linuxquestions.org/quest...mba-4175707395
 
  


Closed Thread



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CIFS: read block indefinitely for file on CIFS and Samba Vnegi Linux - Newbie 1 02-03-2022 02:09 PM
Cifs "mount error 13 = Permission denied" CIFS SUCKS humbletech99 Linux - Networking 45 04-06-2020 05:31 AM
[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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:25 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