After installing RT 5 with a database upgrade I have multiple JSON errors. First an encode error, becouse of which I can’t log in at all. To manage this error I’ve added “allow_blessed => 1 parameter” at Web.pm. Now I can sign in, but have json decode errors on multiple pages. I can fix it by setting allow_nonref to true, but this error occurs on too many pages.
Did you install RT5 into a clean /opt/rt5 directory? There shouldn’t be any code errors on something like login, maybe some rt4 code is left over?
It’s a clean directory, I had rt 4 on that machine, but not is opt/rt5. There isn’t any rt4 code in it, and I don’t have any plugins installed to, but I had many plugins installed to the 4, which has written to the database. So I think the problem is in the database somehow.
Do you have a copy of the JSON error you were seeing on login?
This is it:
error: encountered object ‘1’, but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /usr/local/share/perl/5.24.1/JSON.pm line 173.
context: …
169: $json->$method( $opt->{$method} );
170: }
171: }
172:
173: json->encode(_[0]);
174: }
175:
176:
177: sub from_json ($@) {
…
code stack: /usr/local/share/perl/5.24.1/JSON.pm:173
/opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm:202
/opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm:4590
/opt/rt5/share/html/Elements/JavascriptConfig:93
/opt/rt5/share/html/Elements/Header:64
/opt/rt5/share/html/index.html:4
/opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm:710
/opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm:389
/opt/rt5/share/html/autohandler:53
encountered object ‘1’, but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /usr/local/share/perl/5.24.1/JSON.pm line 173.
Trace begun at /usr/share/perl5/HTML/Mason/Exceptions.pm line 125
HTML::Mason::Exceptions::rethrow_exception(‘encountered object ‘1’, but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /usr/local/share/perl/5.24.1/JSON.pm line 173.^J’) called at /usr/local/share/perl/5.24.1/JSON.pm line 173
JSON::to_json(‘HASH(0x7fa83026aa30)’, ‘HASH(0x7fa83024b258)’) called at /opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm line 202
RT::Interface::Web::EncodeJSON(‘HASH(0x7fa83026aa30)’) called at /opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm line 4590
HTML::Mason::Commands::JSON(‘HASH(0x7fa83026aa30)’) called at /opt/rt5/share/html/Elements/JavascriptConfig line 93
HTML::Mason::Commands::ANON at /usr/share/perl5/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run(‘HTML::Mason::Component::FileBased=HASH(0x7fa83024adf0)’) called at /usr/share/perl5/HTML/Mason/Request.pm line 1302
eval {…} at /usr/share/perl5/HTML/Mason/Request.pm line 1292
HTML::Mason::Request::comp(undef, undef) called at /opt/rt5/share/html/Elements/Header line 64
HTML::Mason::Commands::ANON(‘Title’, ‘Kezdőlap’, ‘Refresh’, 0, ‘SkipDoctype’, 1) called at /usr/share/perl5/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run(‘HTML::Mason::Component::FileBased=HASH(0x7fa83026a4d8)’, ‘Title’, ‘Kezdőlap’, ‘Refresh’, 0, ‘SkipDoctype’, 1) called at /usr/share/perl5/HTML/Mason/Request.pm line 1302
eval {…} at /usr/share/perl5/HTML/Mason/Request.pm line 1292
HTML::Mason::Request::comp(undef, undef, ‘Title’, ‘Kezdőlap’, ‘Refresh’, 0, ‘SkipDoctype’, 1) called at /opt/rt5/share/html/index.html line 4
HTML::Mason::Commands::ANON at /usr/share/perl5/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run(‘HTML::Mason::Component::FileBased=HASH(0x55d826b48ae0)’) called at /usr/share/perl5/HTML/Mason/Request.pm line 1302
eval {…} at /usr/share/perl5/HTML/Mason/Request.pm line 1292
HTML::Mason::Request::comp(undef, undef, undef) called at /opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm line 710
RT::Interface::Web::ShowRequestedPage(‘HASH(0x7fa83003d650)’) called at /opt/rt5/sbin/…/local/lib/RT/Interface/Web.pm line 389
RT::Interface::Web::HandleRequest(‘HASH(0x7fa83003d650)’) called at /opt/rt5/share/html/autohandler line 53
HTML::Mason::Commands::ANON at /usr/share/perl5/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run(‘HTML::Mason::Component::FileBased=HASH(0x7fa83003cff0)’) called at /usr/share/perl5/HTML/Mason/Request.pm line 1300
eval {…} at /usr/share/perl5/HTML/Mason/Request.pm line 1292
HTML::Mason::Request::comp(undef, undef, undef) called at /usr/share/perl5/HTML/Mason/Request.pm line 481
eval {…} at /usr/share/perl5/HTML/Mason/Request.pm line 481
eval {…} at /usr/share/perl5/HTML/Mason/Request.pm line 433
HTML::Mason::Request::exec(‘RT::Interface::Web::Request=HASH(0x55d81ef5dec0)’) called at /usr/share/perl5/HTML/Mason/PSGIHandler.pm line 96
eval {…} at /usr/share/perl5/HTML/Mason/PSGIHandler.pm line 96
HTML::Mason::Request::PSGI::exec(‘RT::Interface::Web::Request=HASH(0x55d81ef5dec0)’) called at /usr/share/perl5/HTML/Mason/Interp.pm line 342
HTML::Mason::Interp::exec(undef, undef) called at /usr/share/perl5/HTML/Mason/PSGIHandler.pm line 59
eval {…} at /usr/share/perl5/HTML/Mason/PSGIHandler.pm line 59
HTML::Mason::PSGIHandler::invoke_mason(‘HTML::Mason::PSGIHandler::Streamy=HASH(0x55d8253eeb18)’, ‘HASH(0x55d8253eee30)’, ‘HASH(0x55d825178f90)’) called at /usr/share/perl5/HTML/Mason/PSGIHandler/Streamy.pm line 52
HTML::Mason::PSGIHandler::Streamy::ANON(‘CODE(0x7fa8300390b8)’) called at /usr/share/perl5/Plack/Util.pm line 339
Plack::Util::ANON(‘CODE(0x7fa830038fc8)’) called at /usr/share/perl5/Plack/Util.pm line 339
Plack::Util::ANON(‘CODE(0x7fa830038ef0)’) called at /usr/share/perl5/Plack/Handler/Apache2.pm line 89
Plack::Handler::Apache2::call_app(‘Plack::Handler::Apache2’, ‘Apache2::RequestRec=SCALAR(0x55d82428c620)’, ‘CODE(0x55d8254bd448)’) called at /usr/share/perl5/Plack/Handler/Apache2.pm line 126
Plack::Handler::Apache2::handler(‘Apache2::RequestRec=SCALAR(0x55d82428c620)’) called at -e line 0
eval {…} at -e line 0
Do you have anything in your /opt/rt5/local
directory?
only the copy of the Web.pm file I made to fix this problem. Only the files I copied from RT to set the parameters when a new json error occurs.
I am seeing the exakt same thing on a new, minimalistic and fresh installation on Ubuntu 20.04 aka Focal:
[77549] [Wed Sep 2 12:06:08 2020] [error]: encountered object '1', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /usr/share/perl5/JSON.pm line 173.
Stack:
[/usr/share/perl5/JSON.pm:173]
[/opt/rt5/sbin/../lib/RT/Interface/Web.pm:202]
[/opt/rt5/sbin/../lib/RT/Interface/Web.pm:4590]
[/opt/rt5/share/html/Elements/JavascriptConfig:93]
[/opt/rt5/share/html/Elements/Header:64]
[/opt/rt5/share/html/dhandler:48]
[/opt/rt5/sbin/../lib/RT/Interface/Web.pm:710]
[/opt/rt5/sbin/../lib/RT/Interface/Web.pm:389]
[/opt/rt5/share/html/autohandler:53] (/opt/rt5/sbin/../lib/RT/Interface/Web/Handler.pm:209)
A collegue of mine found the issue based on an old RT4 bug - For us its fixed with purging libjson-xs-perl. It seems libjson-perl and libjson-xs-perl do have some incompatibilities.
The solution is (at least on Debian) this:
apt purge libjson-xs-perl
cpanm -U JSON::XS
The first is usually some unneeded system dependency and the latter is maybe some unnecessary dependency of make fixdeps
command.
How did you modify the Web.pm file to include the “allow_blessed => 1 parameter”? Could this modification be causing any unintended side effects?