Got 500 Internal Error upon upgrading from 5.3.64 to 5.3.84

I just ran into another 500 Internal Error issue after upgrading automatically from Softaculous. I’ve noticed several reports and tried a few solutions, but it didn’t work. Is there a known way to resolve this quickly? Very last lines of the logs below:

[2022-05-16 22:33:10] production.INFO: db fails  
[2022-05-16 22:38:04] production.ERROR: include(): read of 10476 bytes failed with errno=14 Bad address {"exception":"[object] (ErrorException(code: 0): include(): read of 10476 bytes failed with errno=14 Bad address at /home/mysite/mydomain.in/vendor/composer/ClassLoader.php:571)
[stacktrace]
#0 /home/mysite/mydomain.in/vendor/composer/ClassLoader.php(571): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'include(): read...', '/home/mysite/...', 571, Array)
#1 /home/mysite/mydomain.in/vendor/composer/ClassLoader.php(571): include()
#2 /home/mysite/mydomain.in/vendor/composer/ClassLoader.php(428): Composer\\Autoload\\includeFile('/home/mysite/...')
#3 [internal function]: Composer\\Autoload\\ClassLoader->loadClass('App\\\\Models\\\\Acco...')
#4 /home/mysite/mydomain.in/app/Providers/EventServiceProvider.php(580): spl_autoload_call('App\\\\Models\\\\Acco...')
#5 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Providers\\EventServiceProvider->boot()
#6 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#7 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#8 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#9 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#10 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(924): Illuminate\\Container\\Container->call(Array)
#11 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(905): Illuminate\\Foundation\\Application->bootProvider(Object(App\\Providers\\EventServiceProvider))
#12 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(App\\Providers\\EventServiceProvider), 34)
#13 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(906): array_walk(Array, Object(Closure))
#14 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#15 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#16 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(153): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#17 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(137): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#18 /home/mysite/mydomain.in/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#19 /home/mysite/mydomain.in/public/index.php(57): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#20 {main}
"} 
[2022-05-16 22:44:28] production.INFO: db fails  
[2022-05-16 22:44:29] production.INFO: db fails

Hi,

@david do you have any suggestions?

Can I provide you with any additional input for this?

@Jazz

Have you tried copying over the release file?

https://github.com/invoiceninja/invoiceninja/releases/download/v5.3.95/invoiceninja.zip

@david: No, I haven’t tried it… I relied on automatic updates from Softaculous. I’ll give it a try.

I’m curious to know - what’s the difference between an automated update vs. manually copying over the root project directory?

@Jazz

Softaculous typically handles all the heavy lifting with the upgrade and we rarely see any upgrades go wrong as a result. I’m not sure exactly what has happened here in your case.

One option you may also want to consider is creating a fresh install with softaculous and then pointing it to your old database.

I intentionally skipped a few updates via Softaculous and now I updated it just fine to v5.5.32-C98. It works great, but I spotted a new issue:

I need to send an invoice cancellation (an invoice with negative values) and the application handles negative item values well, it previews the correct numbers, but when I generate the PDF the numbers are NOT negative anymore - they mistakenly became positive. What could cause that and how to fix it?

@david any thoughts?

@Jazz

Can you advise what steps to recreate this, we’ll take a look.

Create an Invoice with a single item that has a negative value, keep it as a Draft, or mark it as Sent.
Go to Invoices > check it displays correctly in a preview HTML (Image 1) > now download it as PDF and check the numbers. (Image 2)

Image 1:
2022-11-10_15-14_1

Image 2:
2022-11-10_15-14

I just noticed another issue after this update:

When I clicked the “Change to the React web app”, it just threw the WSOD and from that point onward I couldn’t use the InvoiceNinja anymore. I had to restore from the last backup to recover from it.

I can’t seem to recreate this at all.

My steps were to create a invoice with a negative value, mark as sent, and then view PDF.

I use the default Phantom JS Cloud for generating PDFs.
What more data could I send you to help you unwrap this issue? Thanks.

@Jazz

Can you try using hosted_ninja for the PDF generator… i wonder if the PDf is just caching.

Unfortunately, I was no able to install the local PDF generator, possibly due my shared hosting’s restrictions, but I’m pretty confident it has nothing to do with the caching since I created the invoice approx. 24h after the update and it was a brand new invoice.

Is there a way to check the source of that particular PDF only? I tried to follow the docs and all I can find is this:

<div id="table-totals" cellspacing="0"><div style="display: flex; flex-direction: column;"><p data-state="encoded-html" data-ref="total_table-public_notes" style="text-align: left;">&lt;p&gt;1 euro - 7.53450 kn
157,60 euro&lt;/p&gt;
</p><p style="text-align: left; display: flex; flex-direction: column; page-break-inside: auto;"><span data-state="encoded-html" data-ref="total_table-terms-label" style="font-weight: bold; text-align: left; margin-top: 1rem;">&lt;p&gt;Napomena:&lt;/p&gt;
</span><span data-state="encoded-html" data-ref="total_table-terms" style="text-align: left;">&lt;p&gt;U slu&#269;aju da navedeni iznos jo&scaron; niste podmirili, molimo Vas da to u&#269;inite do nazna&#269;enog datuma dospije&#263;a pla&#263;anja.&lt;/p&gt;
</span></p><img style="max-width: 50%; height: auto;" src="" id="contact-signature"><div style="margin-top: 1.5rem; display: flex; align-items: flex-start; page-break-inside: auto;"><img src="https://raw.githubusercontent.com/invoiceninja/invoiceninja/v5-develop/public/images/new_logo.png" style="height: 2.5rem;" id="invoiceninja-whitelabel-logo"></div></div><div class="totals-table-right-side" dir="ltr"><div><span data-state="encoded-html" data-ref="totals_table-subtotal-label">&lt;p&gt;Osnovica&lt;/p&gt;
</span><span data-state="encoded-html" data-ref="totals_table-subtotal">&lt;p&gt;950,00 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" data-ref="totals-table-total_tax_0-label">&lt;p&gt;PDV 25%&lt;/p&gt;
</span><span data-state="encoded-html" data-ref="totals-table-total_tax_0">&lt;p&gt;237,50 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" data-ref="totals_table-total-label">&lt;p&gt;Sveukupno&lt;/p&gt;
</span><span data-state="encoded-html" data-ref="totals_table-total">&lt;p&gt;1.187,50 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge1-label">&lt;p&gt;&lt;/p&gt;
</span><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge1">&lt;p&gt;0,00 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge2-label">&lt;p&gt;&lt;/p&gt;
</span><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge2">&lt;p&gt;0,00 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge3-label">&lt;p&gt;&lt;/p&gt;
</span><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge3">&lt;p&gt;0,00 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge4-label">&lt;p&gt;&lt;/p&gt;
</span><span data-state="encoded-html" hidden="1" data-ref="totals_table-custom_surcharge4">&lt;p&gt;0,00 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" data-ref="totals_table-outstanding-label">&lt;p&gt;Stanje duga&lt;/p&gt;
</span><span data-state="encoded-html" data-ref="totals_table-outstanding">&lt;p&gt;1.187,50 HRK&lt;/p&gt;
</span></div><div><span data-state="encoded-html" data-ref="totals_table-paid_to_date-label">&lt;p&gt;Do sada pla&#263;eno&lt;/p&gt;
</span><span data-state="encoded-html" data-ref="totals_table-paid_to_date">&lt;p&gt;0,00 HRK&lt;/p&gt;
</span></div><div><span></span><span></span></div></div></div>

But it contains the numbers only from the last invoice and the one with negative values was created a few days ago.

hosted_ninja doesn’t require any third party libraries and works like phantoms, but we host the servers.

It would be good to exclude Phantom js as the cause in of this issue.

For some reason I read “hosted_ninja” and assumed “snappdf”, I didn’t know about “hosted_ninja” as a valid option until now.

Ok, now I set the “hosted_ninja” as a PDF generator in the .env file, then I ran php artisan optimize, previewed the same PDF Invoice with negative values about 10 minutes ago (then I previewed another one a minute after that) and the same issue appeared - there are still no negative values on the first PDF Invoice. Could you please take a look?

@Jazz

I am stumped on this, I also tried converting the invoice into the same currency, no matter what I did, i was unable to get the negative invoice to display positive.

Thanks for the feedback.
Did you find my PDF generated by hosted_ninja, nothing super obvious there?

Is there any other hint I could provide from my side in order to help debugging this?