1. 程式人生 > >uWSGI/Django Error Log

uWSGI/Django Error Log

write(): Resource temporarily unavailable [plugins/python/uwsgi_pymodule.c line 711]
write(): Resource temporarily unavailable [plugins/python/uwsgi_pymodule.c line 711]
……

猜測,client在未返回完整結果的情況下關閉瀏覽器,nginx停止了當前socket,但未通知uwsgi,uwsgi向nginx返回結果,但被通知已經關閉,所以報錯

An error occurred in the current transaction. You can’t execute queries until the end of the ‘atomic’ block.

runserver執行django專案的時候並未碰到這個問題,但用uwsgi時就比較頻繁了
找到了一個好理解的解釋

with transaction.atomic():
            try:
                do_something()
            except:
                pass
            do_something2()

資料庫在執行do_something()中的某一寫操作時發生了錯誤。但是業務程式碼裡try except捕獲了異常但是沒有將異常丟擲,而是靜默處理。程式碼順利執行至do_something2(),在執行do_something2()中的資料庫請求時,django向資料庫傳送rollback請求,並丟擲異常。

Fri Sep 28 01:06:02 2018 - uwsgi_response_write_headers_do(): Bad file descriptor [core/writer.c line 248] during GET /ws/fpoint (172…~)
OSError: write error

close websocket 時報錯
https://github.com/duanhongyi/dwebsocket/issues/14