html, body { font-size: 15px }
body { font-family: Helvetica, “Hiragino Sans GB”, “微软雅黑”, “Microsoft YaHei UI”, SimSun, SimHei, arial, sans-serif; line-height: 1.6; margin: 0; padding: 1.33rem 1rem }
h1, h2, h3, h4, h5, h6 { margin: 1.33rem 0 0.667rem; padding: 0; font-weight: bold }
h1 { font-size: 1.4rem }
h2 { font-size: 1.33rem }
h3 { font-size: 1.2rem }
h4 { font-size: 1.13rem }
h5 { font-size: 1rem }
h6 { font-size: 1rem; color: rgba(119, 119, 119, 1); margin: 1rem 0 }
div, p, ul, ol, dl, li { margin: 0 }
blockquote, table, pre, code { margin: 8px 0 }
ul, ol { padding-left: 2.13rem }
blockquote { padding: 0 0.8rem }
blockquote>:first-child { margin-top: 0 }
blockquote>:last-child { margin-bottom: 0 }
img { border: 0; max-width: 100%; height: auto !important; margin: 2px 0 }
table { border-collapse: collapse; border: 1px solid rgba(187, 187, 187, 1) }
td, th { padding: 4px 8px; border-collapse: collapse; border: 1px solid rgba(187, 187, 187, 1) }
@media only screen and (-webkit-max-device-width: 1024px), only screen and (-o-max-device-width: 1024px), only screen and (max-device-width: 1024px), only screen and (-webkit-min-device-pixel-ratio: 3), only screen and (-o-min-device-pixel-ratio: 3), only screen and (min-device-pixel-ratio: 3) { html, body { font-size: 17px } body { line-height: 1.7; padding: 0.75rem 0.9375rem; color: rgba(53, 60, 71, 1) } h1 { font-size: 2.125rem } h2 { font-size: 1.875rem } h3 { font-size: 1.625rem } h4 { font-size: 1.375rem } h5 { font-size: 1.125rem } h6 { color: inherit } ul, ol { padding-left: 2.5rem } blockquote { padding: 0 0.9375rem } }
html, body { font-size: 15px }
body { font-family: Arial, Helvetica, “Hiragino Sans GB”, 微软雅黑, “Microsoft YaHei UI”, SimSun, SimHei, arial, sans-serif; line-height: 1.5; margin: 0; padding: 1.33rem 1rem }
img { max-width: 100% }

 

html { height: 100% }
body { min-height: 100%; box-sizing: border-box }
.wiz-img-resize-handle { position: absolute; z-index: 1000; border: 1px solid rgba(0, 0, 0, 1); background-color: rgba(255, 255, 255, 1) }
.wiz-img-resize-handle { width: 5px; height: 5px }
.wiz-img-resize-handle.lt { cursor: nw-resize }
.wiz-img-resize-handle.tm { cursor: n-resize }
.wiz-img-resize-handle.rt { cursor: ne-resize }
.wiz-img-resize-handle.lm { cursor: w-resize }
.wiz-img-resize-handle.rm { cursor: e-resize }
.wiz-img-resize-handle.lb { cursor: sw-resize }
.wiz-img-resize-handle.bm { cursor: s-resize }
.wiz-img-resize-handle.rb { cursor: se-resize }
.wiz-table-body.wiz-table-moving *, .wiz-table-body.wiz-table-moving *:before, .wiz-table-body.wiz-table-moving *:after { cursor: default !important }
td, th { position: relative }
#wiz-table-range-border { display: none; width: 0; height: 0; position: absolute; top: 0; left: 0; z-index: 105 }
#wiz-table-col-line, #wiz-table-row-line { display: none; background-color: rgba(68, 138, 255, 1); position: absolute; z-index: 120 }
#wiz-table-col-line { width: 1px; cursor: col-resize }
#wiz-table-row-line { height: 1px; cursor: row-resize }
#wiz-table-range-border_start, #wiz-table-range-border_range { display: none; width: 0; height: 0; position: absolute }
#wiz-table-range-border_start_top, #wiz-table-range-border_range_top { height: 2px; background-color: rgba(68, 138, 255, 1); position: absolute; top: 0; left: 0 }
#wiz-table-range-border_range_top { height: 1px }
#wiz-table-range-border_start_right, #wiz-table-range-border_range_right { width: 2px; background-color: rgba(68, 138, 255, 1); position: absolute; top: 0 }
#wiz-table-range-border_range_right { width: 1px }
#wiz-table-range-border_start_bottom, #wiz-table-range-border_range_bottom { height: 2px; background-color: rgba(68, 138, 255, 1); position: absolute; top: 0 }
#wiz-table-range-border_range_bottom { height: 1px }
#wiz-table-range-border_start_left, #wiz-table-range-border_range_left { width: 2px; background-color: rgba(68, 138, 255, 1); position: absolute; top: 0; left: 0 }
#wiz-table-range-border_range_left { width: 1px }
#wiz-table-range-border_start_dot, #wiz-table-range-border_range_dot { width: 5px; height: 5px; border: 2px solid rgba(255, 255, 255, 1); background-color: rgba(68, 138, 255, 1); cursor: crosshair; position: absolute; z-index: 110 }
.wiz-table-tools { display: block; background-color: rgba(255, 255, 255, 1); position: absolute; left: 0; border: 1px solid rgba(221, 221, 221, 1); -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; z-index: 130 }
.wiz-table-tools ul { list-style: none; padding: 0 }
.wiz-table-tools .wiz-table-menu-item { position: relative; float: left; margin: 5px 2px 5px 8px }
.wiz-table-tools .wiz-table-menu-item .wiz-table-menu-button { font-size: 15px; width: 20px; height: 20px; line-height: 20px; cursor: pointer; position: relative }
.wiz-table-tools i.editor-icon { font-size: 15px; color: rgba(69, 90, 100, 1) }
.wiz-table-tools .wiz-table-menu-item .wiz-table-menu-button i#wiz-menu-bg-demo { position: absolute; top: 1px; left: 0 }
.wiz-table-tools .wiz-table-menu-sub { position: absolute; display: none; width: 125px; padding: 5px 0; background: rgba(255, 255, 255, 1); border-radius: 3px; border: 1px solid rgba(224, 224, 224, 1); top: 28px; left: -9px; box-shadow: 1px 1px 5px rgba(208, 208, 208, 1) }
.wiz-table-tools .wiz-table-menu-sub>div { font-size: 15px }
.wiz-table-tools .wiz-table-menu-item.active .wiz-table-menu-sub { display: block }
.wiz-table-tools .wiz-table-menu-sub:before, .wiz-table-tools .wiz-table-menu-sub:after { position: absolute; content: ” “; border-top: 0 solid rgba(0, 0, 0, 0); border-right: 8px solid rgba(0, 0, 0, 0); border-bottom: 8px solid rgba(204, 204, 204, 1); border-left: 8px solid rgba(0, 0, 0, 0); left: 22px; margin-left: -14px; top: -8px; z-index: 10 }
.wiz-table-tools .wiz-table-menu-sub:after { border-bottom-color: rgba(255, 255, 255, 1); top: -7px }
.wiz-table-tools .wiz-table-menu-sub-item { padding: 4px 12px; font-size: 14px }
.wiz-table-tools .wiz-table-menu-sub-item.split { border-top: 1px solid rgba(224, 224, 224, 1) }
.wiz-table-tools .wiz-table-menu-sub-item:hover { background-color: rgba(236, 236, 236, 1) }
.wiz-table-tools .wiz-table-menu-sub-item.disabled { color: rgba(187, 187, 187, 1); cursor: default }
.wiz-table-tools .wiz-table-menu-sub-item.disabled:hover { background-color: rgba(0, 0, 0, 0) }
.wiz-table-tools .wiz-table-menu-item.wiz-table-cell-bg:hover .wiz-table-color-pad { display: block }
.wiz-table-tools .wiz-table-color-pad { display: none; padding: 10px; box-sizing: border-box; width: 85px; height: 88px; background-color: rgba(255, 255, 255, 1); cursor: default }
.wiz-table-tools .wiz-table-color-pad>div { font-size: 15px }
.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item { display: inline-block; width: 15px; height: 15px; margin-right: 9px; position: relative }
.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item i.pad-demo { position: absolute; top: 3px; left: 0 }
.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item .icon-oblique_line { color: rgba(204, 0, 0, 1) }
.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item:last-child { margin-right: 0 }
.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item.active i.editor-icon.icon-box { color: rgba(68, 138, 255, 1) }
.wiz-table-tools .wiz-table-cell-align { display: none; padding: 10px; box-sizing: border-box; width: 85px; height: 65px; background-color: rgba(255, 255, 255, 1); cursor: default }
.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item { display: inline-block; width: 15px; height: 15px; margin-right: 9px; position: relative }
.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item:last-child { margin-right: 0 }
.wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item i.valign { position: absolute; top: 3px; left: 0; color: rgba(210, 210, 210, 1) }
.wiz-table-tools .wiz-table-cell-align-item.active i.editor-icon.valign { color: rgba(161, 196, 255, 1) }
.wiz-table-tools .wiz-table-cell-align-item.active i.editor-icon.icon-box, .wiz-table-tools .wiz-table-cell-align-item.active i.editor-icon.align { color: rgba(68, 138, 255, 1) }
.wiz-table-tools .wiz-table-color-pad .wiz-table-color-pad-item:last-child, .wiz-table-tools .wiz-table-cell-align .wiz-table-cell-align-item:last-child { margin-right: 0 }
th.wiz-selected-cell-multi, td.wiz-selected-cell-multi { background: rgba(0, 102, 255, 0.05) }
th:before, td:before, #wiz-table-col-line:before, #wiz-table-range-border_start_right:before, #wiz-table-range-border_range_right:before { content: ” “; position: absolute; top: 0; bottom: 0; right: -5px; width: 9px; cursor: col-resize; background: rgba(0, 0, 0, 0); z-index: 100 }
th:after, td:after, #wiz-table-row-line:before, #wiz-table-range-border_start_bottom:before, #wiz-table-range-border_range_bottom:before { content: ” “; position: absolute; left: 0; right: 0; bottom: -5px; height: 9px; cursor: row-resize; background: rgba(0, 0, 0, 0); z-index: 100 }
.wiz-table-container { }
.wiz-table-body { position: relative; padding: 0 0 10px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch }
.wiz-table-body table { margin: 0; outline: none }
td, th { height: 28px; word-break: break-all; box-sizing: border-box; outline: none }
body pre.prettyprint { padding: 0 }
body pre.prettyprint code { white-space: pre }
body pre.prettyprint.linenums { box-shadow: none; overflow: auto; -webkit-overflow-scrolling: touch }
body pre.prettyprint.linenums ol.linenums { box-shadow: inset 40px 0 rgba(251, 251, 252, 1), inset 41px 0 rgba(236, 236, 240, 1); padding: 10px 10px 10px 40px !important }

Flask 出现 “Broken pipe” 现象说明:
采用 Flask 原生 WSGI 发布 Web(app.run())。随后,发起一个 Request,在 Request 还未返回前停止查询,并重新发起一个新的 Request。服务端很可能出现类似如下的”Broken pipe”报错。
Exception in thread Thread-1:
Traceback (most recent call last):
  File “/usrb64/python2.7/threading.py”, line 811, in __bootstrap_inner
    self.run()
  File “/usrb64/python2.7/threading.py”, line 764, in run
    self.__target(*self.__args, **self.__kwargs)
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 659, in inner
    srv.serve_forever()
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 499, in serve_forever
    HTTPServer.serve_forever(self)
  File “/usrb64/python2.7/SocketServer.py”, line 238, in serve_forever
    self._handle_request_noblock()
  File “/usrb64/python2.7/SocketServer.py”, line 297, in _handle_request_noblock
    self.handle_error(request, client_address)
  File “/usrb64/python2.7/SocketServer.py”, line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File “/usrb64/python2.7/SocketServer.py”, line 321, in process_request
    self.finish_request(request, client_address)
  File “/usrb64/python2.7/SocketServer.py”, line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File “/usrb64/python2.7/SocketServer.py”, line 649, in __init__
    self.handle()
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 216, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File “/usrb64/python2.7/BaseHTTPServer.py”, line 340, in handle
    self.handle_one_request()
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 251, in handle_one_request
    return self.run_wsgi()
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 193, in run_wsgi
    execute(self.server.app)
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 184, in execute
    write(data)
  File “/usrb/python2.7/site-packages/werkzeugrving.py”, line 152, in write
    self.send_header(key, value)
  File “/usrb64/python2.7/BaseHTTPServer.py”, line 401, in send_header
    self.wfile.write(“%s: %s\r\n” % (keyword, value))
IOError: [Errno 32] Broken pipe
 

“Broken pipe” 报错原因:<wiz_tmp_tag id=”wiz-table-range-border” contenteditable=”false” style=”display: none;”>

 
 
 
 
“Broken pipe” 的字面意思为 “管道破裂”,本质为写入端反馈时读端却关闭,因而造成没有及时取走管道中的数据,从而引发程序异常。
 
“Broken pipe” 报错处理方式:
放弃对 Flask 原生 WSGI 的使用,转而使用全功能的 WSGI,例如:gunicorn、uWSGI 等。
 
多种 WSGI 对引发 “Broken pip” 报错操作的响应对比:
1.Flask 原生 WSGI
采用 Flask 原生 WSGI 的最简测试程序如下。
from flask import Flask
                                                                          
app = Flask(__name__)
                                                                             
@app.route(\’/\’)
def index():
    import time
    time.sleep(10)
    return \’Hello World\’
                                   
app.run(host=\’11.4.76.73\’, port=6001)
调用方式如下。
./env/bin/python flasktest.py
当发起一个 Request,在 Request 还未返回前停止查询,并重新发起一个新的 Request时,WSGI 响应类似如下。

注意:报错”Broken pipe”,程序崩溃
2.gunicorn
采用 gunicorn 的最简测试程序如下。
from flask import Flask
                                     
app = Flask(__name__)
                                       
@app.route(\’/\’)
def index():
    import time
    time.sleep(10)
    return \’Hello World\’
调用方式如下。
./env/bin/gunicorn -w 1 –log-level \’debug\’ -b 11.4.76.73:6002 gunicorntest:app
当发起一个 Request,在 Request 还未返回前停止查询,并重新发起一个新的 Request时,WSGI 响应类似如下。

注意:出现”Ignoring connection reset“信息,但不影响应用运行。
3.pywsgi
采用 pywsgi 的最简测试程序如下。
from gevent import monkey
monkey.patch_all()
from flask import Flask
from gevent import pywsgi
                                       
app = Flask(__name__)
                                       
@app.route(\’/\’)
def index():
    import time
    time.sleep(10)
    return \’Hello World\’
                                   
server = pywsgi.WSGIServer((\’11.4.76.73\’, 6003), app)
server.serve_forever()
调用方式如下。
./env/bin/python geventtest.py
当发起一个 Request,在 Request 还未返回前停止查询,并重新发起一个新的 Request时,WSGI 响应类似如下。
注意:应用正常。

版权声明:本文为autopenguin原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/autopenguin/p/6704027.html