简体   繁体   English

XIO:X服务器上的致命IO错误11(资源暂时不可用)在235个请求(235个已知处理)之后“0:0”,剩余0个事件

[英]XIO: fatal IO error 11 (Resource temporarily unavailable) on X server “:0” after 235 requests (235 known processed) with 0 events remaining

Yes other people have asked this question before, but not in the same context or to my satisfaction. 是的,其他人之前已经问过这个问题,但不是在相同的背景下或让我满意。 So, here goes:: 所以,这里::

I am writing an application using python, the program using pygame (ergo opengl) to display the graphics. 我正在使用python编写应用程序,该程序使用pygame(ergo opengl)来显示图形。 The graphics are generated in the program itself (so no directory issues whatsoever). 图形是在程序本身中生成的(因此没有任何目录问题)。

The application also needs to access the input parallely from a user. 应用程序还需要从用户并行访问输入。 To achieve this I use a multiprocessing block with a pipe and read the input key using pygame event loop. 为了实现这一点,我使用带管道的多处理块,并使用pygame事件循环读取输入键。 The below code runs in a loop. 下面的代码循环运行。 The first loop iteration works fine, but on the 2nd iteration I am thrown that XIO error. 第一次循环迭代工作正常,但在第二次迭代时,我抛出了XIO错误。

   parent, child = Pipe(duplex=True)
   # this function draws the canvas
   switches, retOrient = self.drawCanvas(cond, count, dispSize, moves)
   # this function gets the user input in another thread - stage 1
   p = Process(target=userInput, args=(self.button, child) )
   p.start()
   b_press = parent.recv()
   parent.close()

def userInput(button, child):
    button_pressed = button.blockAndWait()
    child.send( "%s"%(button_pressed.keyname) )
    child.close()

I am a little perplexed at how this error occurs, what are the internals in XIO that cause it. 我对这个错误是如何发生有点困惑,XIO内部导致它的原因是什么。 None of the other answers actually explain the root cause of this error. 其他答案都没有解释这个错误的根本原因。 Considering it works fine as a single process application, the multiprocessing module is closing some IO channel (the input registered object, the display object or the event loop) or opening some unnecessary channels. 考虑到它作为单个流程应用程序工作正常,多处理模块正在关闭一些IO通道(输入注册对象,显示对象或事件循环)或打开一些不必要的通道。 How can I decipher what exactly is causing this XIO error? 如何解读导致此XIO错误的确切原因?

Not necessarily a real answer, but I would not use multiprocessing to parallelize access to sockets like the connection to the X server. 不一定是真正的答案,但我不会使用multiprocessing来并行访问套接字,例如与X服务器的连接。 That looks like a bad idea. 这看起来不错。 Use regular threads instead. 请改用常规线程。

Be aware that multiprocessing is a hack based (sometimes) on forking, so what exactly occurs with a forked socket when both the parent and the child try to access it... is random mixed garbage. 请注意, multiprocessing是基于分支(有时)基于分叉,因此当父项和子项尝试访问它时,分叉套接字究竟发生了什么......是随机混合垃圾。

EDIT: the reason is that both forked sockets are still the "same end" of the socket, with the X server holding on the "other end". 编辑:原因是两个分叉套接字仍然是套接字的“同一端”,X服务器保持在“另一端”。 When the X server wants to send a message, it writes, say, 100 bytes on the socket. 当X服务器想要发送消息时,它会在套接字上写入100个字节。 But if you're unlucky, the forked process 1 reads the first 50 bytes and the forked process 2 reads the remaining 50 bytes. 但是如果你运气不好,分叉进程1读取前50个字节,分叉进程2读取剩余的50个字节。 Each process is unexpectedly getting only a random part of the message. 每个进程都意外地只获得了消息的随机部分。 They will each complain that the X server is sending nonsense. 他们每个人都会抱怨X服务器发送废话。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python:X服务器上的致命IO错误11(资源暂时不可用):0.0 - python: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0 蓝牙错误(11,资源暂时不可用) - bluetooth error(11,resource are temporarily unavailable) 在Python 2.xx中修复“[Errno 11]资源暂时不可用”? - Fix “[Errno 11] Resource temporarily unavailable” in Python 2.x.x? 部署 Python Web 应用程序后出现 App Engine 错误 - BlockingIOError: [Errno 11] 资源暂时不可用 - App Engine error after Python web app is deployed - BlockingIOError: [Errno 11] Resource temporarily unavailable 随机出现“ socket.error:[Errno 11]资源暂时不可用” - “socket.error: [Errno 11] Resource temporarily unavailable” appears randomly BlockingIOError: [Errno 11] 资源暂时不可用 两个客户端 一个服务器 sockets python - BlockingIOError: [Errno 11] Resource temporarily unavailable two clients one server sockets python Python错误:发送图像时“socket.error:[Errno 11]资源暂时不可用” - Python error: “socket.error: [Errno 11] Resource temporarily unavailable” when sending image rocksdb.errors.RocksIOError:IO错误:锁定文件时:sample.db / LOCK:资源暂时不可用 - rocksdb.errors.RocksIOError: IO error: While lock file: sample.db/LOCK: Resource temporarily unavailable Python中的子进程模块资源暂时不可用错误 - Resource temporarily unavailable error with subprocess module in Python 如何使用uwsgi + nginx解决[Errno 11]资源暂时不可用 - How to solve [Errno 11] Resource temporarily unavailable using uwsgi + nginx
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM