Skip to content

Win32 asynchronous queries hang on connection error #66

@ged

Description

@ged

Original report by Rafał Bigaj (Bitbucket: rafalbigaj, GitHub: rafalbigaj).


I encountered the following problems on win32 system with all version of pg (0.9.0, 0.9.1, 0.10.0, 0.10.1 and 0.11.0) on Ruby 1.9:

During asynchronous queries the CPU usage is 100% - rb_w32_thread_select does not wait any time on foreign socket (not created with ruby socket API). The only way I found to workaround the problem is simple waiting 1ms before each select if the PG is busy.

PQConsumeInput result is not interpreted in pgconn_block what makes the waiting loop infinite (PQisBusy returns always TRUE) if connection error occurs

pgconn_async_exec can block the interpreter for a long time on initial pgconn_get_last_result (pgconn_block is not called before)

I have committed the fixes for above problems to my fork at:
https://bitbucket.org/rafalbigaj/ruby-pg/changeset/17a6a01c1725

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions