{"id":2194,"date":"2026-12-02T16:50:58","date_gmt":"2026-12-03T00:50:58","guid":{"rendered":"https:\/\/wp.c9h.org\/cj\/?p=2194"},"modified":"2026-12-02T17:48:26","modified_gmt":"2026-12-03T01:48:26","slug":"bringing-non-blocking-io-to-perls-dbi-looking-for-community-feedback","status":"publish","type":"post","link":"https:\/\/wp.c9h.org\/cj\/2026\/12\/bringing-non-blocking-io-to-perls-dbi-looking-for-community-feedback\/","title":{"rendered":"Bringing Non-Blocking I\/O to Perl&#8217;s DBI: Looking for Community Feedback"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Disclaimer: The opinions stated here are my own, not those of my employer.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Over my past two posts on bringing <a href=\"https:\/\/wp.c9h.org\/cj\/2026\/11\/why-perl-lost-the-cloud-era-and-how-native-grpc-protobuf-and-genai-sdks-can-bring-it-back\/\">native gRPC, Protocol Buffers, and Cloud\/GenAI SDKs<\/a> and <a href=\"https:\/\/wp.c9h.org\/cj\/2026\/11\/bringing-modern-ml-columnar-io-and-rag-to-perl-data-language-pdlporters\/\">modern columnar I\/O, vector search, and ML engines<\/a> to Perl (now tracked across 35 distributions in the <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-pdl\/pdl-ecosystem-pr-reviewers-guide.html\">PDL Data &amp; ML Ecosystem PR Reviewer&#8217;s Guide<\/a>), a long-standing architectural gap kept resurfacing: once a Perl service is speaking multiplexed HTTP\/2 RPCs and streaming Arrow batches in contiguous C memory, how should it talk to relational and cloud databases without blocking the event loop?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post introduces an <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/issues\/183\">upstream RFC issue (<code>perl5-dbi\/dbi#183<\/code>)<\/a>, a <a href=\"https:\/\/www.nntp.perl.org\/group\/perl.dbi.dev\/2026\/07\/msg8398.html\"><code>perl.dbi.dev<\/code> mailing list discussion<\/a>, a working core implementation in <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/pull\/185\"><code>perl5-dbi\/dbi#185<\/code><\/a> (branch <a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/tree\/feature\/non-blocking-core\"><code>feature\/non-blocking-core<\/code><\/a>, accompanied by a commit-by-commit <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html\">PR #185 Reviewer&#8217;s Guide<\/a>), and 8 companion <code>DBD::*<\/code> pull requests bringing a unified, zero-ABI-breakage non-blocking contract to <a href=\"https:\/\/metacpan.org\/pod\/DBI\">Perl&#8217;s <code>DBI<\/code><\/a>. Nothing in this API surface is set in stone: the primary goal right now is gathering critical review from <code>DBI<\/code> and <code>DBD::*<\/code> maintainers, async framework authors, and Perl application developers before finalizing the driver contract.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"twenty-years-of-async-fragmentation\">1. Twenty Years in the Making: Why Async Perl Databases Fragmented<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When <a href=\"https:\/\/metacpan.org\/author\/TIMB\">Tim Bunce<\/a> architected <code>DBI<\/code> in 1994, vendor C client libraries were overwhelmingly synchronous. As event loops and coroutines grew in popularity, standardizing non-blocking execution inside <code>DBI<\/code> became one of Perl&#8217;s longest-running open design threads:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>2004:<\/strong> Tim Bunce&#8217;s official August 2004 <code>DBI<\/code> roadmap listed <em>&#8220;Support non-blocking mode for drivers that can enable it in their client API&#8221;<\/em>, and early <code>dbi-dev<\/code> proposals around <code>$sth-&gt;ready<\/code> and <code>$sth-&gt;done<\/code> explored how to reconcile differing vendor C state machines.<\/li>\n\n\n\n<li><strong>2010:<\/strong> <code>DBI 1.615<\/code> shipped <a href=\"https:\/\/metacpan.org\/pod\/DBD::Gofer::Transport::corostream\"><code>DBD::Gofer::Transport::corostream<\/code><\/a> as an experimental <a href=\"https:\/\/metacpan.org\/pod\/Coro\"><code>Coro<\/code><\/a>\/<a href=\"https:\/\/metacpan.org\/pod\/AnyEvent\"><code>AnyEvent<\/code><\/a> proxy, while noting in the documentation that globally overriding <code>CORE::select<\/code> was fragile.<\/li>\n\n\n\n<li><strong>2018:<\/strong> <a href=\"https:\/\/github.com\/pali\">Pali<\/a> opened <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/issues\/52\"><code>perl5-dbi\/dbi#52<\/code><\/a> requesting a stable, driver-independent <code>DBI<\/code> API unifying <a href=\"https:\/\/metacpan.org\/pod\/DBD::Pg\"><code>DBD::Pg<\/code><\/a> and <a href=\"https:\/\/metacpan.org\/pod\/DBD::mysql\"><code>DBD::mysql<\/code><\/a> (alongside parallel statement execution). Tim Bunce <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/issues\/52#issuecomment-361071159\">replied with an open invitation<\/a> for someone to synthesize the prior discussions on <code>dbi-dev<\/code> and drive a concrete implementation forward.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In the absence of a core contract, individual drivers and frameworks solved the problem incompatibly:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/metacpan.org\/pod\/DBD::Pg\"><code>DBD::Pg<\/code><\/a> exposed <code>PG_ASYNC<\/code>, <code>pg_ready<\/code>, <code>pg_result<\/code>, and <code>$dbh-&gt;{pg_socket}<\/code> over <a href=\"https:\/\/www.postgresql.org\/docs\/current\/libpq-async.html\"><code>libpq<\/code><\/a>.<\/li>\n\n\n\n<li><a href=\"https:\/\/metacpan.org\/pod\/DBD::mysql\"><code>DBD::mysql<\/code><\/a> added <code>mysql_async<\/code>, <code>mysql_async_ready<\/code>, <code>mysql_async_result<\/code>, and <code>$dbh-&gt;mysql_fd<\/code>.<\/li>\n\n\n\n<li><a href=\"https:\/\/metacpan.org\/pod\/DBD::MariaDB\"><code>DBD::MariaDB<\/code><\/a> introduced <code>mariadb_async<\/code>, <code>mariadb_async_ready<\/code>, <code>mariadb_async_result<\/code>, and <code>$dbh-&gt;mariadb_sockfd<\/code>.<\/li>\n\n\n\n<li><a href=\"https:\/\/metacpan.org\/pod\/DBD::ODBC\"><code>DBD::ODBC<\/code><\/a> relied on ODBC&#8217;s <code>SQL_ATTR_ASYNC_ENABLE<\/code> and <code>SQL_STILL_EXECUTING<\/code> polling model without exposing a POSIX socket descriptor at all.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Higher-level frameworks either had to reach underneath <code>DBI<\/code> for driver-specific file descriptors (as <a href=\"https:\/\/metacpan.org\/pod\/Mojo::Pg\"><code>Mojo::Pg<\/code><\/a> and <a href=\"https:\/\/metacpan.org\/pod\/DBIx::Poggy\"><code>DBIx::Poggy<\/code><\/a> do), spin up separate worker processes (<a href=\"https:\/\/metacpan.org\/pod\/AnyEvent::DBI\"><code>AnyEvent::DBI<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/DBIx::Class::Async\"><code>DBIx::Class::Async<\/code><\/a>), or bypass <code>DBI<\/code> altogether (<a href=\"https:\/\/metacpan.org\/pod\/Database::Async\"><code>Database::Async<\/code><\/a>).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"core-design-of-dbi-185\">2. Core Design of <code>perl5-dbi\/dbi#185<\/code>: Five Engineering Pillars<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1600\" height=\"1360\" src=\"https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?resize=1600%2C1360&#038;ssl=1\" alt=\"Architecture diagram of non-blocking Perl DBI core support (PR #185) across event-loop adapters, DBIXS.h C\/XS driver helpers, relational SQL drivers, and multiplexed HTTP\/2 Cloud drivers.\" class=\"wp-image-2193\" srcset=\"https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?w=1600&amp;ssl=1 1600w, https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?resize=300%2C255&amp;ssl=1 300w, https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?resize=1024%2C870&amp;ssl=1 1024w, https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?resize=768%2C653&amp;ssl=1 768w, https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2026\/12\/non-blocking-dbi-stack.png?resize=1536%2C1306&amp;ssl=1 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><figcaption class=\"wp-element-caption\">Figure 1: Non-blocking readiness contract in perl5-dbi\/dbi#185 spanning event-loop adapters, ABI-preserving core state, DBIXS.h C\/XS helpers, and 8 companion relational and HTTP\/2 cloud drivers.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Pull request <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/pull\/185\"><code>perl5-dbi\/dbi#185<\/code><\/a> implements a minimal, opt-in non-blocking core across <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#commit-by-commit-reading-order\">8 focused commits<\/a> (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/56bd55e\"><code>56bd55e<\/code><\/a> through <a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/2ad72af\"><code>2ad72af<\/code><\/a>, touching 13 files at <code>+1,412 \/ -13<\/code> lines, with all 228 test files and 12,104 assertions passing; see the <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#local-verification-commands\">local verification commands<\/a>), alongside a POSIX-pipe reference driver (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/b22c5bd\"><code>DBD::MockAsync<\/code><\/a>), <code>DBI::PurePerl<\/code> and <code>DBD::Gofer<\/code> parity (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/2af5246\"><code>2af5246<\/code><\/a>), and a formal driver specification in <a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/blob\/feature\/non-blocking-core\/lib\/DBI\/DBD.pm\"><code>DBI::DBD<\/code><\/a> (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/4731bd9\"><code>4731bd9<\/code><\/a>). Five constraints guided the design:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#does-this-break-binary-abi-for-existing-compiled-dbds\">Zero Binary ABI Breakage<\/a> (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/56bd55e\"><code>56bd55e<\/code><\/a>, <a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/5c3d3c0\"><code>5c3d3c0<\/code><\/a>):<\/strong> Five new handle flags (<code>DBIcf_Async<\/code>, <code>DBIcf_AsyncWantRead<\/code>, <code>DBIcf_AsyncWantWrite<\/code>, <code>DBIcf_AsyncMultiplex<\/code>, and <code>DBIcf_AsyncBufferWrites<\/code>) pack into unused upper bits (<code>0x01000000<\/code> through <code>0x10000000<\/code>) of <code>dbih_com_std_t.flags<\/code>, while two new per-interpreter <code>dbistate_t<\/code> fields (<code>async_wouldblock_sv<\/code> and <code>async_notify_watcher<\/code>) claim 2 of the 3 existing reserved <code>pad2<\/code> pointer slots (leaving <code>pad2[1]<\/code> free). Neither struct sizes nor field offsets change. For OS packagers maintaining <a href=\"https:\/\/packages.debian.org\/trixie\/libdbi-perl\"><code>libdbi-perl<\/code><\/a> alongside dozens of precompiled XS drivers in Debian <code>trixie<\/code>\/<code>forky<\/code> or Enterprise Linux, upgrading <code>DBI<\/code> requires zero binary <code>perl-dbi-abi<\/code> rebuild transitions.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#what-happens-to-synchronous-applications-that-never-set-async--1\">Strict Synchronous Isolation<\/a>:<\/strong> All <code>WOULDBLOCK<\/code> sentinel interception and suppression of <code>RaiseError<\/code>, <code>PrintError<\/code>, and <code>HandleError<\/code> are strictly gated on <code>DBIc_ASYNC(imp_xxh)<\/code>. Existing synchronous applications (even when using legacy drivers that emit <code>err == -1<\/code>) behave identically to stock <code>DBI<\/code>.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#2-built-in-dbiasyncwatcher-adapters-2ad72af\">Event-Loop-Agnostic Readiness<\/a> (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/2ad72af\"><code>2ad72af<\/code><\/a>):<\/strong> Drivers notify an optional <code>AsyncWatcher<\/code> object via <code>on_add<\/code>, <code>on_modify<\/code>, and <code>on_remove<\/code> callbacks carrying the socket descriptor and readiness mode (<code>\"r\"<\/code>, <code>\"w\"<\/code>, or <code>\"rw\"<\/code>), and event loops drive state machines forward via <code>$h-&gt;async_read_ready()<\/code> and <code>$h-&gt;async_write_ready()<\/code>. Optional lazy-loaded <code>DBI::AsyncWatcher<\/code> adapters cover <a href=\"https:\/\/metacpan.org\/pod\/IO::Async\"><code>IO::Async<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/AnyEvent\"><code>AnyEvent<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/EV\"><code>EV<\/code><\/a>, and <a href=\"https:\/\/metacpan.org\/pod\/Mojo::IOLoop\"><code>Mojo::IOLoop<\/code><\/a> (or <a href=\"https:\/\/metacpan.org\/pod\/Future::AsyncAwait\"><code>Future::AsyncAwait<\/code><\/a> wrappers) with zero new core CPAN prerequisites.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#3-driver-side-cxs-integration-ifdef-dbicf_async\">First-Class C\/XS Driver Helpers<\/a>:<\/strong> <code>DBIXS.h<\/code> exposes <code>DBIh_ASYNC_SET_WOULDBLOCK<\/code>, <code>DBIh_ASYNC_NOTIFY_WATCHER<\/code>, and <code>DBIh_ASYNC_CLEAR_WANT<\/code> under <code>#ifdef DBIcf_Async<\/code>, eliminating roughly 50 lines of error-prone Perl-stack and <code>PERL_MAGIC_tied<\/code> C boilerplate per driver while allowing updated XS drivers to compile cleanly against older <code>DBI<\/code> releases.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#how-does-this-interact-with-ithreads-and-fork\">Concurrency, <code>fork()<\/code>, and Thread Safety<\/a> (<a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/2ff8959\"><code>2ff8959<\/code><\/a>, <a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/76aeab9\"><code>76aeab9<\/code><\/a>):<\/strong> A parent-aware concurrency guard blocks accidental synchronous calls while <code>AsyncWantRead<\/code> or <code>AsyncWantWrite<\/code> is active on a statement handle or its parent <code>$dbh<\/code> (unless <code>AsyncMultiplex =&gt; 1<\/code> is advertised by an HTTP\/2 or multiplexed transport); storing async state on per-interpreter <code>dbistate_t<\/code> keeps Perl <code>ithreads<\/code> clean under <a href=\"https:\/\/valgrind.org\/\">Valgrind<\/a>; and <code>DESTROY<\/code> skips PID checks so <code>AutoInactiveDestroy<\/code> continues to work safely across <code>fork()<\/code>.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-it-looks-like-in-practice\">3. What It Looks Like in Practice<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">From Perl application code, connecting in non-blocking mode, attaching an event-loop watcher, and streaming rows without driver-specific method names looks identical whether the backend is PostgreSQL, MariaDB, MySQL, or Cloud Spanner:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use strict;\nuse warnings;\nuse DBI qw(:async);\nuse DBI::AsyncWatcher;\n\nmy $dbh = DBI-&gt;connect('dbi:Pg:dbname=app', $user, $pass, {\n    RaiseError =&gt; 1,\n    Async      =&gt; 1,\n});\n$dbh-&gt;{AsyncWatcher} = DBI::AsyncWatcher-&gt;new('AnyEvent', $dbh);\n\nmy $sth = $dbh-&gt;prepare('SELECT id, name FROM accounts WHERE active = ?');\nmy $rv  = $sth-&gt;execute(1);\n\nif (DBI::is_wouldblock($sth-&gt;err)) {\n    defined(my $rows = $sth-&gt;async_read_ready()) or die $sth-&gt;errstr;\n}\n\nwhile (my $row = $sth-&gt;fetch_async_row()) {\n    last if DBI::is_wouldblock($row);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside a C\/XS driver&#8217;s <code>dbdimp.c<\/code>, signaling a non-blocking read yield and registering the underlying socket file descriptor with the caller&#8217;s watcher takes just a few lines guarded by <code>#ifdef DBIcf_Async<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#ifdef DBIcf_Async\nif (DBIc_ASYNC(imp_sth)) {\n    DBIc_ASYNC_WANT_READ_on(imp_sth);\n    DBIc_ASYNC_WANT_READ_on(imp_dbh);\n    DBIh_ASYNC_SET_WOULDBLOCK(sth, imp_sth);\n    DBIh_ASYNC_NOTIFY_WATCHER(sth, imp_sth, fd, \"on_add\", \"r\");\n    return 0;\n}\n#endif<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"eight-companion-driver-prototypes\">4. Proving the Contract Across 8 Companion Drivers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A core specification is only useful if real drivers with very different wire models can implement it cleanly. Early <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#community-collaboration--feedback-addressed-so-far\">community engagement across <code>dbi-users<\/code>, <code>perl.dbi.dev<\/code>, and <code>perl5-dbi\/dbi#185<\/code><\/a> shaped every major trade-off in this prototype:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Single-Event-Loop Principle &amp; Core Isolation (<a href=\"https:\/\/metacpan.org\/author\/DAVIDNICO\">David Nicol<\/a>):<\/strong> David immediately highlighted the core constraint (&#8220;a system should have only one event loop&#8221;), arguing for a simple &#8220;async-check-and-do&#8221; readiness model and lightweight cooperative <code>defer<\/code>\/<code>yield<\/code> primitives rather than baking heavy futures or promises into <code>DBI<\/code> core. He also pushed us to explicitly weigh three architectural paths: core C-engine flags, a higher-level named-template facade (handling handle weakening to prevent closure leaks), or a greenfield parallel namespace (<code>DBI_NB::<\/code> \/ <code>DBD_NB::<\/code>) to leave rock-solid blocking <code>DBI<\/code> untouched. Weighing that clean-break simplicity against Python 2-to-3-style ecosystem fragmentation led directly to the backward-compatible <code>ndbi<\/code> proof-of-concept fork.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/metacpan.org\/pod\/POE\"><code>POE<\/code><\/a> Patterns &amp; Review Stewardship (<a href=\"https:\/\/metacpan.org\/author\/KSTAR\">Kurt Starsinic<\/a>, H. Merijn Brand \/ <code>Tux<\/code>, and Dani&euml;l van Eeden):<\/strong> With <code>Tux<\/code> and Dani&euml;l van Eeden following the design thread from July 2026 onward, Kurt stepped up to evaluate how <a href=\"https:\/\/metacpan.org\/pod\/POE::Component::EasyDBI\"><code>POE::Component::EasyDBI<\/code><\/a> and <code>POE<\/code> event-loop patterns fit the readiness contract, and <code>Tux<\/code> both encouraged careful multi-reviewer scrutiny (motivating the 8-commit split and Reviewer&#8217;s Guide) and suggested Kurt as an arbiter for the PR <code>#185<\/code> review.<\/li>\n\n\n\n<li><strong>Security Hardening &amp; Driver Adoption (<a href=\"https:\/\/github.com\/robrwo\">Robert Rothenberg \/ <code>robrwo<\/code><\/a> and <a href=\"https:\/\/github.com\/esabol\">Ed Sabol \/ <code>esabol<\/code><\/a>):<\/strong> Robert (<a href=\"https:\/\/security.metacpan.org\/\">CPAN Security Group<\/a>) contributed an incisive review catching unconditional <code>err == -1<\/code> suppression, file-static <code>ithreads<\/code> lifetimes, statement-level capability gates, <code>DESTROY<\/code> across <code>fork()<\/code>, and mortal accumulation in <code>fetch_async_*<\/code>, while Ed asked, <em>&#8220;What do we need to do for <code>DBD::Pg<\/code>? PR welcome!&#8221;<\/em><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Answering that question led to building and testing 8 companion pull requests spanning traditional C\/XS SQL sockets, timer-polled ODBC handles, and HTTP\/2 multiplexed gRPC cloud databases:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Driver<\/th><th>Pull Request<\/th><th>Transport &amp; Verification Highlights<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/metacpan.org\/pod\/DBD::Pg\"><code>DBD::Pg<\/code><\/a> (<a href=\"https:\/\/packages.debian.org\/trixie\/libdbd-pg-perl\">Debian<\/a>)<\/td><td><a href=\"https:\/\/github.com\/bucardo\/dbdpg\/pull\/224\">bucardo\/dbdpg#224<\/a><\/td><td><a href=\"https:\/\/www.postgresql.org\/docs\/current\/libpq-async.html\"><code>libpq<\/code><\/a> (<code>PG_ASYNC<\/code>, <code>PQsocket<\/code>, <code>PQflush<\/code>); verified against live PostgreSQL 17 (<code>14\/14<\/code> new <code>t\/09async_dbi.t<\/code> + <code>127\/127<\/code> existing <code>t\/08async.t<\/code> PASS)<\/td><\/tr><tr><td><a href=\"https:\/\/metacpan.org\/pod\/DBD::mysql\"><code>DBD::mysql<\/code><\/a> (<a href=\"https:\/\/packages.debian.org\/trixie\/libdbd-mysql-perl\">Debian<\/a>)<\/td><td><a href=\"https:\/\/github.com\/perl5-dbi\/DBD-mysql\/pull\/505\">DBD-mysql#505<\/a><\/td><td>C client <code>mysql_async<\/code>, <code>mysql_async_ready<\/code>, <code>mysql_async_result<\/code>, and <code>net.fd<\/code> socket readiness<\/td><\/tr><tr><td><a href=\"https:\/\/metacpan.org\/pod\/DBD::MariaDB\"><code>DBD::MariaDB<\/code><\/a> (<a href=\"https:\/\/packages.debian.org\/trixie\/libdbd-mariadb-perl\">Debian<\/a>)<\/td><td><a href=\"https:\/\/github.com\/perl5-dbi\/DBD-MariaDB\/pull\/257\">DBD-MariaDB#257<\/a><\/td><td>Non-blocking MariaDB wire state machine (<code>mariadb_async_*<\/code> and <code>sock_fd<\/code>)<\/td><\/tr><tr><td><a href=\"https:\/\/metacpan.org\/pod\/DBD::ODBC\"><code>DBD::ODBC<\/code><\/a><\/td><td><a href=\"https:\/\/github.com\/perl5-dbi\/DBD-ODBC\/pull\/35\">DBD-ODBC#35<\/a><\/td><td>ODBC <code>SQL_ATTR_ASYNC_ENABLE<\/code> \/ <code>SQL_STILL_EXECUTING<\/code> timer-driven polling without requiring a POSIX socket FD<\/td><\/tr><tr><td><code>DBD::Spanner<\/code><\/td><td><a href=\"https:\/\/github.com\/GoogleCloudPlatform\/google-auth-library-perl\/pull\/42\">google-auth-library-perl#42<\/a><\/td><td>Concurrent statement execution over multiplexed HTTP\/2 gRPC (<code>AsyncMultiplex =&gt; 1<\/code>) with legacy-DBI fallback<\/td><\/tr><tr><td><code>DBD::BigQuery<\/code><\/td><td><a href=\"https:\/\/github.com\/GoogleCloudPlatform\/google-auth-library-perl\/pull\/43\">google-auth-library-perl#43<\/a><\/td><td>Async <code>JobServiceClient<\/code> polling plus optional lazy-loaded <a href=\"https:\/\/metacpan.org\/pod\/Google::Cloud::Bigquery::Storage::V1\">Storage Read API<\/a> and <a href=\"https:\/\/github.com\/PDLPorters\/PDL-IO-Arrow\/pull\/1\"><code>PDL::IO::Arrow<\/code><\/a> columnar batch side-loading<\/td><\/tr><tr><td><code>DBD::Bigtable<\/code><\/td><td><a href=\"https:\/\/github.com\/GoogleCloudPlatform\/google-auth-library-perl\/pull\/44\">google-auth-library-perl#44<\/a><\/td><td>GoogleSQL v2 <code>ExecuteQuery<\/code> streaming over non-blocking HTTP\/2 gRPC (<code>AsyncMultiplex =&gt; 1<\/code>)<\/td><\/tr><tr><td><code>DBD::Datastore<\/code><\/td><td><a href=\"https:\/\/github.com\/GoogleCloudPlatform\/google-auth-library-perl\/pull\/45\">google-auth-library-perl#45<\/a><\/td><td>GQL v1 <code>RunQuery<\/code> over non-blocking HTTP\/2 gRPC (<code>AsyncMultiplex =&gt; 1<\/code>)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#real-bugs--insights-caught-by-dogfooding\">Exercising all eight drivers<\/a> against live databases and event loops immediately surfaced subtleties a synthetic mock could have missed: exempting diagnostic accessors (<code>$sth-&gt;err<\/code>, <code>errstr<\/code>, <code>state<\/code>, and <code>set_err<\/code>) from the active-handle concurrency guard during live PostgreSQL 17 runs; switching <code>DBI::AsyncWatcher<\/code> from Perl&#8217;s FD-aliasing <code>'&lt;&amp;='<\/code> mode to <a href=\"https:\/\/manpages.debian.org\/trixie\/manpages-dev\/dup.2.en.html\"><code>dup(2)<\/code><\/a>-backed <code>'&lt;&amp;'<\/code> so watcher garbage collection never closes a driver&#8217;s underlying socket; standardizing <code>async_read_ready()<\/code> return values (<code>0<\/code> while pending, row count or <code>'0E0'<\/code> on completion, <code>undef<\/code> strictly on error); supporting <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#what-about-drivers-without-a-posix-socket-fd-eg-dbdodbc\">non-FD drivers like <code>DBD::ODBC<\/code><\/a> via timer polling; and proving pure-Perl dual-DBI compatibility via <code>defined(&amp;DBI::is_wouldblock)<\/code> so updated drivers remain installable on older <code>DBI<\/code> releases.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"open-questions-for-community-feedback\">5. Open Design Questions: Looking for Community Feedback<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Because a core <code>DBI<\/code> contract will live for decades once released, getting the ergonomics and edge cases right matters far more than merging quickly. We would especially value maintainer and user feedback on five open design questions:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html#why-introduce-fetch_async_row-instead-of-reusing-fetchrow_array\"><code>fetch_async_row()<\/code> yield convention<\/a>:<\/strong> Should <code>fetch_async_row()<\/code> return the <code>DBI_ASYNC_WOULDBLOCK<\/code> sentinel on a non-blocking yield, or should it return <code>undef<\/code> (using <code>$sth-&gt;{AsyncWantRead}<\/code> to distinguish a temporary pause from end-of-stream) so a naive <code>while (my $row = $sth-&gt;fetch_async_row)<\/code> loop can never accidentally dereference a truthy sentinel?<\/li>\n\n\n\n<li><strong>Signaling <code>WOULDBLOCK<\/code> via <code>$h-&gt;err<\/code> vs. handle attributes:<\/strong> Is signaling would-block via <code>$h-&gt;err<\/code> (analogous to POSIX <a href=\"https:\/\/manpages.debian.org\/trixie\/manpages-dev\/errno.3.en.html\"><code>EAGAIN<\/code><\/a>, strictly gated on <code>Async =&gt; 1<\/code>) ergonomic for Perl callers, or is leaving <code>$h-&gt;err<\/code> untouched on yield and inspecting <code>$h-&gt;{AsyncWantRead}<\/code> cleaner?<\/li>\n\n\n\n<li><strong><code>DBI::AsyncWatcher<\/code> packaging:<\/strong> Should the lazy-loaded event-loop adapters in <a href=\"https:\/\/github.com\/LLC-Technologies-Collier\/ndbi\/commit\/2ad72af\"><code>DBI::AsyncWatcher<\/code><\/a> ship in <code>DBI<\/code> core (where they introduce zero hard dependencies), or live in a separate CPAN distribution so adapter release cadence stays decoupled from <code>DBI<\/code>?<\/li>\n\n\n\n<li><strong>Driver capability opt-in:<\/strong> Is checking for a driver-implemented <code>async_read_ready<\/code> method the cleanest capability gate for <code>Async =&gt; 1<\/code>, or would <code>DBD::*<\/code> authors prefer an explicit driver capability flag?<\/li>\n\n\n\n<li><strong>Additional <code>DBD::*<\/code> prototypes:<\/strong> Which other driver maintainers (for example <a href=\"https:\/\/metacpan.org\/pod\/DBD::Oracle\"><code>DBD::Oracle<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/DBD::SQLite\"><code>DBD::SQLite<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/DBD::Firebird\"><code>DBD::Firebird<\/code><\/a>, or <a href=\"https:\/\/metacpan.org\/pod\/DBD::DB2\"><code>DBD::DB2<\/code><\/a>) would like to test or co-author non-blocking prototypes against <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/pull\/185\"><code>perl5-dbi\/dbi#185<\/code><\/a>?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">If you maintain a <code>DBD::*<\/code> driver, work on <a href=\"https:\/\/metacpan.org\/pod\/IO::Async\"><code>IO::Async<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/Future::AsyncAwait\"><code>Future::AsyncAwait<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/AnyEvent\"><code>AnyEvent<\/code><\/a>, <a href=\"https:\/\/metacpan.org\/pod\/POE\"><code>POE<\/code><\/a>, or <a href=\"https:\/\/metacpan.org\/pod\/Mojolicious\"><code>Mojolicious<\/code><\/a>, or run high-concurrency Perl services in production, please check out the <a href=\"https:\/\/wp.c9h.org\/~cjac\/for-dbi\/pr-185-reviewers-guide.html\">PR #185 Reviewer&#8217;s Guide<\/a> and share your thoughts on <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/pull\/185\"><code>perl5-dbi\/dbi#185<\/code><\/a>, the <a href=\"https:\/\/github.com\/perl5-dbi\/dbi\/issues\/183\">RFC issue (<code>#183<\/code>)<\/a>, or the <a href=\"https:\/\/www.nntp.perl.org\/group\/perl.dbi.dev\/2026\/07\/msg8398.html\"><code>perl.dbi.dev<\/code> mailing list thread<\/a>.<\/p>\n\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=cjamescollier\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>An upstream RFC and zero-ABI-breakage core implementation for non-blocking Perl DBI (perl5-dbi\/dbi#185), validated across 8 companion drivers (DBD::Pg, DBD::mysql, DBD::MariaDB, DBD::ODBC, DBD::Spanner, DBD::BigQuery, DBD::Bigtable, and DBD::Datastore), with open design questions for maintainer and community review.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[337,322,17,79,47,102,18,166,335],"tags":[367,348,366,280,343,370,369,371,372,342,351,368,347,350],"class_list":["post-2194","post","type-post","status-publish","format-standard","hentry","category-337","category-bookworm","category-debian","category-free-software","category-linux","category-open-source","category-perl","category-software","category-trixie","tag-async","tag-bigquery","tag-dbi","tag-debian","tag-grpc","tag-mariadb","tag-mysql","tag-odbc","tag-open-source","tag-perl","tag-pkg-perl","tag-postgresql","tag-spanner","tag-trixie"],"jetpack_shortlink":"https:\/\/wp.me\/p1YDIB-zo","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/posts\/2194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/comments?post=2194"}],"version-history":[{"count":7,"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/posts\/2194\/revisions"}],"predecessor-version":[{"id":2207,"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/posts\/2194\/revisions\/2207"}],"wp:attachment":[{"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/media?parent=2194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/categories?post=2194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/wp-json\/wp\/v2\/tags?post=2194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}