Lỗi Python nghiêm trọng: init_sys_streams: là một thư mục không thể tiếp tục

https. //liên kết. khả năng phục hồi. com/hc/en-us/articles/1500004887782-how-to-install-Agent-on-TrueNAS-trong-the-jail

 

Sự cố này xảy ra

 

'Chuỗi hiện tại 0x0000000800a42000 [lần gọi gần đây nhất trước]

Fatal Python error: init_sys_streams: is a directory, cannot continue

Trạng thái thời gian chạy Python. khởi tạo lõi'

 

Phản hồi khác mà tôi nhận được khi cố gắng nhập các tên nhóm khác nhau là "zsh. Không có tập tin hoặc thư mục"

 

Tôi được thông báo rằng có thể là do giá trị PYTHONPATH được đặt trong hệ thống không hợp lệ. Để giải quyết, hãy hủy đặt giá trị của biến môi trường này bằng cách sử dụng lệnh sau "bỏ đặt PYTHONPATH" Rất tiếc, tôi không thể làm như vậy, có thể tôi đã làm điều gì đó không đúng . Tôi đã thử bỏ cài đặt qua 'unset /usr/bin/python' nhưng được hiển thị 'tên thông số không hợp lệ. Tôi cũng đã thử xuất PYTHONPATH sau đó bỏ đặt để thử đặt lại nhưng không có kết quả. Tôi vẫn đang học nên có thể đã bỏ lỡ điều gì đó nhưng nếu có bất kỳ ý tưởng và liên kết nào đến tài liệu học tập về vấn đề này sẽ được đánh giá cao.

Được tạo vào 2018-02-15 09. 20 bởi rudolphf, thay đổi lần cuối 2022-04-11 14. 58 bởi quản trị viên. vấn đề giờ đã kết thúc

- [view]Tác giả. Rudolph Froger [rudolphf]Ngày. 2018-02-15 09. 20
Sometimes a new Python 3.6.4 process is aborted by the kernel [FreeBSD 11.1] [before loading my Python files].

Found in syslog:

kernel: pid 22433 [python3.6], uid 2014: exited on signal 6 [core dumped]
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

I've been able to run ktrace on such a Python process, see attachment. See around line 940: "RET   fstat -1 errno 9 Bad file descriptor"
- [xem]Tác giả. Alexey Izbyshev [izbyshev] * #30225 is probably not what you want because while the error message will be gone the corresponding std stream will be None [sys.stdin in the case that you ktrace'd]. However, if fd 0 really becomes unusable for some reason, there isn't anything Python can do. Given your description and ktrace log, I can't imagine why fd 0 would behave strangely only in Python. I've attached a small C program to check fd 0. Could you compile it and run in an infinite loop from the shell in an attempt to reproduce this? - [xem]Tác giả. Alexey Izbyshev [izbyshev] * //bitbucket.org/tildeslash/monit/issues/649/init_env-fails-if-open-2-returns-an As for Python, it seems OK to fix it as in #30225 since the fd is unusable for I/O anyway. I think that we can even drop dup-based validation from is_valid_fd[] since there is a corner case for Linux too: if a descriptor opened with O_PATH inherited as a standard one, dup[] will succeed but fstat[] will fail in kernels before 3.6. And we do fstat[] almost immediately after is_valid_fd[] to get blksize, so the dup-based optimization doesn't seem worth the trouble. Victor, do you have an opinion on that? - [xem]Tác giả. Alexey Izbyshev [izbyshev] * sig=sig@entry=6] at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f8f5dfe742a in __GI_abort [] at abort.c:89 #2 0x0000559515870286 in fatal_error [prefix=prefix@entry=0x5595159837f0 "init_sys_streams", msg=msg@entry=0x559515983480 "can't initialize sys standard streams", status=-1] at Python/pylifecycle.c:2179 #3 0x0000559515871062 in _Py_FatalInitError [err=...] at Python/pylifecycle.c:2198 #4 0x000055951577d1f5 in pymain_init [pymain=pymain@entry=0x7ffe886aafc0] at Modules/main.c:3019 #5 0x000055951577d215 in pymain_main [pymain=pymain@entry=0x7ffe886aafc0] at Modules/main.c:3032 #6 0x000055951577d29a in _Py_UnixMain [argc=, argv=] at Modules/main.c:3072 #7 0x00005595157763e9 in main [argc=, argv=] at ./Programs/python.c:15 - [xem]Tác giả. STINNER Victor [vstinner] * #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]' python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'0 - [xem]Tác giả. STINNER Victor [vstinner] * #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]' python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'1 - [xem]Tác giả. STINNER Victor [vstinner] * #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]' python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'2 - [view]Tác giả. STINNER Victor [vstinner] * #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]' python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'3 - [xem]Tác giả. STINNER Victor [vstinner] * #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]' python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'4 - [xem]Tác giả. STINNER Victor [vstinner] * #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]' python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'5 - [xem]Tác giả. Rudolph Froger [rudolphf]Ngày. 2019-04-17 19. 04
ktrace shows that dup[0] succeeded but fstat[0] failed. The symptom is the same as in #30225. Could you check whether any of the following quick tests produces the same error?

python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[w]; subprocess.call[[sys.executable, "-c", ""], stdin=r]'

python3 -c 'import os, subprocess, sys; r, w = os.pipe[]; os.close[r]; subprocess.call[[sys.executable, "-c", ""], stdin=w]'
6

Chủ Đề