#12 Duplicate libpyfcgi.IoIn implementation to write using streams only

已關閉
yannweb4 年之前建立 · 0 條評論

For the moment, embed python sys.stdout & sys.stdin are replaced by pipes in order to catch all stuff sent to stdout/stderr.

On the PEP333 worker, this pipes are read, logged & flushed when the entrypoint function returns.

On the alternate IO worker, this pipes are polled by a cloned thread. As data becomes available, the thread read the pipe and log/send to libfcgi fetched data.

The PEP333 behavior has a major flow : if application send to much data to one pipe, the write call will block indefinitely (the worker should be killed by a watchdog).

The alternate IO worker behavior implies to clone as soon as FCGX_Accept calls returns (in order to be able to use the FCGX_PutStr function on returned streams…)

A simple solution to both problems is to create a libpyfcgi.IoOut classes, implementing a RawIO write only interface : when write* method is called, the data is sent where is should be (in log for PEP333, in log or to libfcgi for alternate IO workers).

Note : seems like a lot of stuff from IoIn can be factorised with IoOut class (see #13)…

For the moment, embed python sys.stdout & sys.stdin are replaced by pipes in order to catch all stuff sent to stdout/stderr. On the PEP333 worker, this pipes are read, logged & flushed when the entrypoint function returns. On the alternate IO worker, this pipes are polled by a cloned thread. As data becomes available, the thread read the pipe and log/send to libfcgi fetched data. The PEP333 behavior has a major flow : if application send to much data to one pipe, the write call will block indefinitely (the worker should be killed by a watchdog). The alternate IO worker behavior implies to clone as soon as FCGX_Accept calls returns (in order to be able to use the FCGX_PutStr function on returned streams...) __A simple solution to both problems is to create a libpyfcgi.IoOut classes, implementing a RawIO write only interface : when write* method is called, the data is sent where is should be (in log for PEP333, in log or to libfcgi for alternate IO workers).__ Note : seems like a lot of stuff from IoIn can be factorised with IoOut class (see #13)...
yannweb 新增至BETA version 里程碑 4 年之前
yannweb 加上了
enhancement
標籤 4 年之前
yannweb 加上了
_libpyfcgi
標籤 4 年之前
yannweb 修改標題從 Duplicate libpyfcgi.IoIn implementation for write only streamsDuplicate libpyfcgi.IoIn implementation to write only streams 4 年之前
yannweb 修改標題從 Duplicate libpyfcgi.IoIn implementation to write only streamsDuplicate libpyfcgi.IoIn implementation to write using streams only 4 年之前
yannweb4 年之前 關閉
登入 才能加入這對話。
未選擇里程碑
No Assignees
1 參與者
截止日期

未設定截止日期。

Dependencies

This issue currently doesn't have any dependencies.

Loading…
取消
儲存
尚未有任何內容