time: extra slash when opening /etc/localtime
larytet opened this issue · comments
This is a minor problem. In the trace of a golang service I see that the path to "/etc//localtime" contains two slashes. Can be a bug in my trace application or a bug in the path concatenation in the runtime. My runtime is
$ go version
go version go1.12.4 linux/amd64
Another question. How Go runtime chooses the buffer size for reading? For example, 0x10000 for the file somaxconn, but 4K for "localtime" ?
Time stamp Syscall PID TID FD Filename
5e25b9eb.1ce74225 openat 24 12789 12789 3 "/etc/ld.so.cache"
5e25b9eb.1ce7eee7 close 34 12789 12789 3 0 "/etc/ld.so.cache"
5e25b9eb.1ce889d4 openat 24 12789 12789 3 "/lib/x86_64-linux-gnu/libpthread.so.0"
5e25b9eb.1ce8c3e2 read 37 12789 12789 3 832 00000832 "/lib/x86_64-linux-gnu/libpthread.so.0"
5e25b9eb.1ceec5bd close 34 12789 12789 3 0 "/lib/x86_64-linux-gnu/libpthread.so.0"
5e25b9eb.1cf012be openat 24 12789 12789 3 "/lib/x86_64-linux-gnu/libc.so.6"
5e25b9eb.1cf0805c read 37 12789 12789 3 832 00000832 "/lib/x86_64-linux-gnu/libc.so.6"
5e25b9eb.1cf2d0f3 close 34 12789 12789 3 0 "/lib/x86_64-linux-gnu/libc.so.6"
5e25b9eb.1f91adfc socket 03 12789 12789 3 526337 01 00
5e25b9eb.1f9245d0 close 34 12789 12789 3 0
5e25b9eb.1f92620e socket 03 12789 12789 3 526337 01 00
5e25b9eb.1f927d5a close 34 12789 12789 3 0
5e25b9eb.1f92d0f4 openat 24 12789 12789 3 "/etc/nsswitch.conf"
5e25b9eb.1f931329 read 37 12789 12789 3 556 00004096 "/etc/nsswitch.conf"
5e25b9eb.1f93477c read 37 12789 12789 3 0 00004096 "/etc/nsswitch.conf"
5e25b9eb.1f934df5 close 34 12789 12789 3 0 "/etc/nsswitch.conf"
5e25b9eb.1f93714b openat 24 12789 12789 3 "/etc/ld.so.cache"
5e25b9eb.1f9392fc close 34 12789 12789 3 0 "/etc/ld.so.cache"
5e25b9eb.1f93c198 openat 24 12789 12789 3 "/lib/x86_64-linux-gnu/libnss_compat.so.2"
5e25b9eb.1f93d12e read 37 12789 12789 3 832 00000832 "/lib/x86_64-linux-gnu/libnss_compat.so.2"
5e25b9eb.1f9451c8 close 34 12789 12789 3 0 "/lib/x86_64-linux-gnu/libnss_compat.so.2"
5e25b9eb.1f94df12 openat 24 12789 12789 3 "/etc/ld.so.cache"
5e25b9eb.1f94f563 close 34 12789 12789 3 0 "/etc/ld.so.cache"
5e25b9eb.1f95104f openat 24 12789 12789 3 "/lib/x86_64-linux-gnu/libnss_nis.so.2"
5e25b9eb.1f95203b read 37 12789 12789 3 832 00000832 "/lib/x86_64-linux-gnu/libnss_nis.so.2"
5e25b9eb.1f957860 close 34 12789 12789 3 0 "/lib/x86_64-linux-gnu/libnss_nis.so.2"
5e25b9eb.1f95a188 openat 24 12789 12789 3 "/lib/x86_64-linux-gnu/libnsl.so.1"
5e25b9eb.1f95b05f read 37 12789 12789 3 832 00000832 "/lib/x86_64-linux-gnu/libnsl.so.1"
5e25b9eb.1f9610f7 close 34 12789 12789 3 0 "/lib/x86_64-linux-gnu/libnsl.so.1"
5e25b9eb.1f963a0b openat 24 12789 12789 3 "/lib/x86_64-linux-gnu/libnss_files.so.2"
5e25b9eb.1f96483b read 37 12789 12789 3 832 00000832 "/lib/x86_64-linux-gnu/libnss_files.so.2"
5e25b9eb.1f969f1f close 34 12789 12789 3 0 "/lib/x86_64-linux-gnu/libnss_files.so.2"
5e25b9eb.1f976222 openat 24 12789 12789 3 "/etc/passwd"
5e25b9eb.1f97c2d3 close 34 12789 12789 3 0 "/etc/passwd"
5e25b9eb.1f9f059a write 36 12789 12789 1 34 00000034 /dev/pts/3
5e25b9eb.1fa617f4 openat 24 12789 12789 3 "/etc//localtime"
5e25b9eb.1fa646cb read 37 12789 12789 3 2265 00004096 "/etc//localtime"
5e25b9eb.1fa660bc read 37 12789 12789 3 0 00004096 "/etc//localtime"
5e25b9eb.1fa669b7 close 34 12789 12789 3 0 "/etc//localtime"
5e25b9eb.1fa74945 write 36 12789 12789 2 73 00000073 /dev/pts/3
5e25b9eb.1fb2bdcc socket 03 12789 12789 3 526337 02 06
5e25b9eb.1fb30a30 close 34 12789 12789 3 0
5e25b9eb.1fb3320e socket 03 12789 12789 3 526337 10 06
5e25b9eb.1fb4879a bind 06 12789 12789 3 0000
5e25b9eb.1fb49d64 socket 03 12789 12789 4 526337 10 06
5e25b9eb.1fb4c2ad bind 06 12789 12789 4 0000
5e25b9eb.1fb4d180 close 34 12789 12789 4 0
5e25b9eb.1fb4e700 close 34 12789 12789 3 0
5e25b9eb.1fb4f28e socket 03 12789 12789 3 526337 10 00
5e25b9eb.1fb6a89b openat 24 12789 12789 4 "/proc/sys/net/core/somaxconn"
5e25b9eb.1fbe215c read 37 12789 12789 4 4 00065536 "/proc/sys/net/core/somaxconn"
5e25b9eb.1fbe4ab3 read 37 12789 12789 4 0 00065532 "/proc/sys/net/core/somaxconn"
5e25b9eb.1fbe5f21 close 34 12789 12789 4 0 "/proc/sys/net/core/somaxconn"
5e25b9eb.1fbf7fb6 bind 06 12789 12789 3 8080
Hi,
regarding this:
In the trace of a golang service I see that the path to "/etc//localtime" contains two slashes. Can be a bug in my trace application or a bug in the path concatenation in the runtime.
it'll be hard to investigate this without a reproducer. You'll have to provide a way to reproduce the issue; can you post a runnable, auto-contained program that shows the problem?
Regarding this:
Another question. How Go runtime chooses the buffer size for reading?
the Go project does not use its bug tracker for general discussion or asking questions about the language. The Github bug tracker is only used for tracking bugs. The Questions wiki page; it has a list of good places for asking questions.
The log above is generated by my own wrapper for SystemTap. I assume that running a Go process under strace demonstrates the problem. For example, this is what I get
strace ./examples/http-server 2> >(grep localtime)
openat(AT_FDCWD, "/etc//localtime", O_RDONLY) = 3
Change https://golang.org/cl/215519 mentions this issue: time: remove unnecessary trailing slash from "/etc/"
I don't know if this is a bug, exactly, but we may as well fix it. I sent a CL, for the future 1.15 release.
I don't know if this is a bug, exactly, but we may as well fix it. I sent a CL, for the future 1.15 release.
Golang team's incredible motivation and devotion continues to surprise me.