Page MenuHomePhabricator

Database crash when closing connection
Closed, DuplicatePublic

Description

Here's the error message:

1{
2 "backtrace": [
3 {
4 "args": [
5 "integer",
6 "string",
7 "string",
8 "integer",
9 "array"
10 ],
11 "class": "MWExceptionHandler",
12 "file": "/X/mediawiki-core/includes/libs/rdbms/database/DatabaseMysqli.php",
13 "function": "handleError",
14 "line": 233,
15 "type": "::"
16 },
17 {
18 "args": [
19 "boolean"
20 ],
21 "class": "Wikimedia\\Rdbms\\DatabaseMysqli",
22 "file": "/X/mediawiki-core/includes/libs/rdbms/database/DatabaseMysqlBase.php",
23 "function": "mysqlNumRows",
24 "line": 362,
25 "type": "->"
26 },
27 {
28 "args": [
29 "boolean"
30 ],
31 "class": "Wikimedia\\Rdbms\\DatabaseMysqlBase",
32 "file": "/X/mediawiki-core/includes/libs/rdbms/database/Database.php",
33 "function": "numRows",
34 "line": 1284,
35 "type": "->"
36 },
37 {
38 "args": [
39 "string",
40 "string",
41 "boolean",
42 "string"
43 ],
44 "class": "Wikimedia\\Rdbms\\Database",
45 "file": "/X/mediawiki-core/includes/libs/rdbms/database/Database.php",
46 "function": "doProfiledQuery",
47 "line": 1182,
48 "type": "->"
49 },
50 {
51 "args": [
52 "string",
53 "string"
54 ],
55 "class": "Wikimedia\\Rdbms\\Database",
56 "file": "/X/mediawiki-core/includes/libs/rdbms/database/Database.php",
57 "function": "query",
58 "line": 3920,
59 "type": "->"
60 },
61 {
62 "args": [
63 "string"
64 ],
65 "class": "Wikimedia\\Rdbms\\Database",
66 "file": "/X/mediawiki-core/includes/libs/rdbms/database/Database.php",
67 "function": "doCommit",
68 "line": 3891,
69 "type": "->"
70 },
71 {
72 "args": [
73 "string",
74 "string"
75 ],
76 "class": "Wikimedia\\Rdbms\\Database",
77 "file": "/X/mediawiki-core/includes/libs/rdbms/loadbalancer/LoadBalancer.php",
78 "function": "commit",
79 "line": 1408,
80 "type": "->"
81 },
82 {
83 "args": [
84 "Wikimedia\\Rdbms\\DatabaseMysqli"
85 ],
86 "class": "Wikimedia\\Rdbms\\LoadBalancer",
87 "file": "/X/mediawiki-core/includes/libs/rdbms/loadbalancer/LoadBalancer.php",
88 "function": "Wikimedia\\Rdbms\\{closure}",
89 "line": 1776,
90 "type": "->"
91 },
92 {
93 "args": [
94 "Closure"
95 ],
96 "class": "Wikimedia\\Rdbms\\LoadBalancer",
97 "file": "/X/mediawiki-core/includes/libs/rdbms/loadbalancer/LoadBalancer.php",
98 "function": "forEachOpenMasterConnection",
99 "line": 1413,
100 "type": "->"
101 },
102 {
103 "args": [
104 "string"
105 ],
106 "class": "Wikimedia\\Rdbms\\LoadBalancer",
107 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactory.php",
108 "function": "commitMasterChanges",
109 "line": 219,
110 "type": "->"
111 },
112 {
113 "args": [
114 "Wikimedia\\Rdbms\\LoadBalancer",
115 "string",
116 "array"
117 ],
118 "class": "Wikimedia\\Rdbms\\LBFactory",
119 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactorySimple.php",
120 "function": "Wikimedia\\Rdbms\\{closure}",
121 "line": 152,
122 "type": "->"
123 },
124 {
125 "args": [
126 "Closure",
127 "array"
128 ],
129 "class": "Wikimedia\\Rdbms\\LBFactorySimple",
130 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactory.php",
131 "function": "forEachLB",
132 "line": 221,
133 "type": "->"
134 },
135 {
136 "args": [
137 "string",
138 "array"
139 ],
140 "class": "Wikimedia\\Rdbms\\LBFactory",
141 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactory.php",
142 "function": "forEachLBCallMethod",
143 "line": 274,
144 "type": "->"
145 },
146 {
147 "args": [
148 "string"
149 ],
150 "class": "Wikimedia\\Rdbms\\LBFactory",
151 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactory.php",
152 "function": "commitMasterChanges",
153 "line": 179,
154 "type": "->"
155 },
156 {
157 "args": [
158 "integer"
159 ],
160 "class": "Wikimedia\\Rdbms\\LBFactory",
161 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactory.php",
162 "function": "shutdown",
163 "line": 152,
164 "type": "->"
165 },
166 {
167 "args": [],
168 "class": "Wikimedia\\Rdbms\\LBFactory",
169 "file": "/X/mediawiki-core/includes/libs/rdbms/lbfactory/LBFactory.php",
170 "function": "destroy",
171 "line": 728,
172 "type": "->"
173 },
174 {
175 "args": [],
176 "class": "Wikimedia\\Rdbms\\LBFactory",
177 "function": "__destruct",
178 "type": "->"
179 }
180 ],
181 "caught_by": "mwe_handler",
182 "code": 0,
183 "file": "/X/mediawiki-core/includes/libs/rdbms/database/DatabaseMysqli.php",
184 "id": "049ca2ac7058db6fb6ff0f1d",
185 "line": 233,
186 "message": "PHP Notice: Trying to get property of non-object",
187 "suppressed": true,
188 "type": "ErrorException",
189 "url": "/opensearch_desc.php"
190}

I did some basic debugging here and it seems that the LbFactory::shutdown COMMIT query is being detected as a read query. That switches on the logic to call "numRows" on the result, but the result is boolean true and then we experience the above meltdown.

This code has been jiggled lately, but the basic assumptions seem to have been unchanged for a long time, so I'm not sure why my personal box is seeing this error.