Problems in templates in Rt 4.2.1

This message is related to my previous thread titled “HTML templates in RT 4.2.1”.

I changed the subject because I think the problem is unfortunately deeper than I thought at first.

Even with our much-simplified template (attached), we sometimes have stack dumps in the RT log, related to template parsing.
Sometimes the stack dump starts with “[error]: Template parsing error: …”, and this usually does not prevent RT from sending out the email.
Other times the stack dump starts with: “[error]: Scrip Preapre nn died. …” and this does prevent RT from sending out the email.

I have been unable to track down the offending elements. Every case seems different.
I am somehow convinced it can be tracked down to changes in the way RT shreds HTML, but I have no proof till now.

Here are a couple of stack dumps:

[14911] [Thu Jan 2 10:25:43 2014] [error]: Template parsing error: Can’t call method “content” on an undefined value at /usr/local/share/perl5/HTML/FormatText/W
ithLinks/AndTables.pm line 217.

Stack:
[/usr/local/share/perl5/HTML/FormatText/WithLinks/AndTables.pm:217]
[/usr/local/share/perl5/HTML/FormatText/WithLinks/AndTables.pm:101]
[/usr/local/share/perl5/HTML/FormatText/WithLinks/AndTables.pm:83]
[/opt/rt4/sbin/…/lib/RT/Interface/Email.pm:1777]
[/opt/rt4/sbin/…/lib/RT/Transaction.pm:348]
[template:14]
[/opt/rt4/sbin/…/lib/RT/Template.pm:551]
[/opt/rt4/sbin/…/lib/RT/Template.pm:507]
[/opt/rt4/sbin/…/lib/RT/Template.pm:435]
[/opt/rt4/sbin/…/lib/RT/Template.pm:415]
[/opt/rt4/sbin/…/lib/RT/Action/SendEmail.pm:139]
[/opt/rt4/sbin/…/lib/RT/Action/Notify.pm:69]
[/opt/rt4/sbin/…/lib/RT/ScripAction.pm:222]
[/opt/rt4/sbin/…/lib/RT/Scrip.pm:561]
[/opt/rt4/sbin/…/lib/RT/Scrips.pm:358]
[/opt/rt4/sbin/…/lib/RT/Transaction.pm:189]
[/opt/rt4/sbin/…/lib/RT/Record.pm:1626]
[/opt/rt4/sbin/…/lib/RT/Ticket.pm:533]
[/opt/rt4/sbin/…/lib/RT/Interface/Email.pm:1415]
[/opt/rt4/share/html/REST/1.0/NoAuth/mail-gateway:61] (/opt/rt4/sbin/…/lib/RT/Template.pm:546)
[22792] [Thu Jan 2 15:29:03 2014] [error]: Scrip Prepare 10 died. - Can’t call method “content” on an undefined value at /usr/local/share/perl5/HTML/FormatText/
WithLinks/AndTables.pm line 217.

Stack:
[/usr/local/share/perl5/HTML/FormatText/WithLinks/AndTables.pm:217]
[/usr/local/share/perl5/HTML/FormatText/WithLinks/AndTables.pm:101]
[/usr/local/share/perl5/HTML/FormatText/WithLinks/AndTables.pm:83]
[/opt/rt4/sbin/…/lib/RT/Interface/Email.pm:1777]
[/opt/rt4/sbin/…/lib/RT/Template.pm:666]
[/opt/rt4/sbin/…/lib/RT/Template.pm:421]
[/opt/rt4/sbin/…/lib/RT/Action/SendEmail.pm:139]
[/opt/rt4/sbin/…/lib/RT/Action/Notify.pm:69]
[/opt/rt4/sbin/…/lib/RT/ScripAction.pm:222]
[/opt/rt4/sbin/…/lib/RT/Scrip.pm:561]
[/opt/rt4/sbin/…/lib/RT/Scrips.pm:358]
[/opt/rt4/sbin/…/lib/RT/Scrips.pm:291]
[/opt/rt4/sbin/…/lib/RT/Ticket.pm:2555]
[/opt/rt4/sbin/…/lib/RT/Ticket.pm:2526]
[/opt/rt4/sbin/…/lib/RT/Ticket.pm:2596]
[/usr/local/share/perl5/HTML/Mason/Request.pm:1295]
[/opt/rt4/share/html/Ticket/autohandler:66]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:680]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:368]
[/opt/rt4/share/html/autohandler:53] (/opt/rt4/sbin/…/lib/RT/Scrip.pm:564)

Anybody seeing this?

Bye
Cris

simple_resolved_template.txt (5.32 KB)

This message is related to my previous thread titled “HTML templates
in RT 4.2.1”.

This is a known bug in 4.2.1, relating to how RT attempts to generate a
plain-text version of HTML templates. A fix will be in 4.2.2 which will
ensure that mail is always sent out, even if it lacks a text/plain part
due to failure of the HTML->text conversion.

  • Alex

Alex Vandiver ha scritto:> On Thu, 2014-01-02 at 16:18 +0000, Guadagnino Cristiano wrote:

This message is related to my previous thread titled “HTML templates
in RT 4.2.1”.
This is a known bug in 4.2.1, relating to how RT attempts to generate a
plain-text version of HTML templates. A fix will be in 4.2.2 which will
ensure that mail is always sent out, even if it lacks a text/plain part
due to failure of the HTML->text conversion.

  • Alex
    Thank you very much Alex!
    Do you know if a patch is available?

Bye
Cris

-----Messaggio originale-----
Da: Cristiano Guadagnino guadagnino.cristiano@creval.it
Inviato: Fri Jan 03 2014 07:59:45 GMT+0100 (CET)
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] Problems in templates in Rt 4.2.1

Alex Vandiver ha scritto:

This message is related to my previous thread titled “HTML templates
in RT 4.2.1”.
This is a known bug in 4.2.1, relating to how RT attempts to generate a
plain-text version of HTML templates. A fix will be in 4.2.2 which will
ensure that mail is always sent out, even if it lacks a text/plain part
due to failure of the HTML->text conversion.

  • Alex
    Thank you very much Alex!
    Do you know if a patch is available?

Never mind Alex, I just read about it in another reply.

Bye
Cris

-----Messaggio originale-----
Da: Cristiano Guadagnino guadagnino.cristiano@creval.it
Inviato: Fri Jan 03 2014 08:03:12 GMT+0100 (CET)
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] Problems in templates in Rt 4.2.1

-----Messaggio originale-----
Da: Cristiano Guadagnino guadagnino.cristiano@creval.it
Inviato: Fri Jan 03 2014 07:59:45 GMT+0100 (CET)
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] Problems in templates in Rt 4.2.1

Alex Vandiver ha scritto:

This message is related to my previous thread titled “HTML templates
in RT 4.2.1”.
This is a known bug in 4.2.1, relating to how RT attempts to generate a
plain-text version of HTML templates. A fix will be in 4.2.2 which will
ensure that mail is always sent out, even if it lacks a text/plain part
due to failure of the HTML->text conversion.

  • Alex
    Thank you very much Alex!
    Do you know if a patch is available?

Never mind Alex, I just read about it in another reply.

Bye
Cris

Hi Alex,
while trying to apply the patch in

https://github.com/bestpractical/rt/commit/8807f0d0.patch

I get this:

can’t find file to patch at input line 26

Looking at the patch file, I see it is trying to patch two files:

/opt/rt4/lib/RT/Template.pm
/opt/rt4/t/mail/html-outgoing.t

The second file is non-existent here. Actually, I don’t have any
/opt/rt4/t directory nor any html-outgoing.t file under /opt/rt4.

Can you help me?

T.I.A.
Bye
Cris

-----Messaggio originale-----
Da: Cristiano Guadagnino guadagnino.cristiano@creval.it
Inviato: Fri Jan 03 2014 10:22:21 GMT+0100 (CET)
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] Problems in templates in Rt 4.2.1

-----Messaggio originale-----
Da: Cristiano Guadagnino guadagnino.cristiano@creval.it

-----Messaggio originale-----
Da: Cristiano Guadagnino guadagnino.cristiano@creval.it

Alex Vandiver ha scritto:

This message is related to my previous thread titled “HTML templates
in RT 4.2.1”.
This is a known bug in 4.2.1, relating to how RT attempts to generate a
plain-text version of HTML templates. A fix will be in 4.2.2 which
will
ensure that mail is always sent out, even if it lacks a text/plain part
due to failure of the HTML->text conversion.

  • Alex
    Thank you very much Alex!
    Do you know if a patch is available?

Never mind Alex, I just read about it in another reply.

Bye
Cris

Hi Alex,
while trying to apply the patch in

https://github.com/bestpractical/rt/commit/8807f0d0.patch

I get this:

can’t find file to patch at input line 26

Looking at the patch file, I see it is trying to patch two files:

/opt/rt4/lib/RT/Template.pm
/opt/rt4/t/mail/html-outgoing.t

The second file is non-existent here. Actually, I don’t have any
/opt/rt4/t directory nor any html-outgoing.t file under /opt/rt4.

Can you help me?

T.I.A.
Bye
Cris

Alex,
I figured that I needed to apply the patch to the source tree, so I did
it successfully. Then I did a “make upgrade”. All of this was done on a
test server.

After that, I compared the new tree in /opt/rt4 with a backup of the old
tree. Diff says only /opt/rt4/lib/RT/Template.pm is changed.

Is it safe to just copy the new Template.pm into our production server
and clear the mason cache? Will it suffice to fix the bug?

Thank you in advance
Cris

Hi Alex,
while trying to apply the patch in

https://github.com/bestpractical/rt/commit/8807f0d0.patch

I get this:

can’t find file to patch at input line 26

Looking at the patch file, I see it is trying to patch two files:

/opt/rt4/lib/RT/Template.pm
/opt/rt4/t/mail/html-outgoing.t

The second file is non-existent here. Actually, I don’t have any
/opt/rt4/t directory nor any html-outgoing.t file under /opt/rt4.

Can you help me?

T.I.A.
Bye
Cris

Alex,
I figured that I needed to apply the patch to the source tree, so I did
it successfully. Then I did a “make upgrade”. All of this was done on a
test server.

After that, I compared the new tree in /opt/rt4 with a backup of the old
tree. Diff says only /opt/rt4/lib/RT/Template.pm is changed.

Is it safe to just copy the new Template.pm into our production server
and clear the mason cache? Will it suffice to fix the bug?

Thank you in advance
Cris

I tried just making the changes in the Template.pm file and that did not work.
Doing that caused fatal problems, resulting in 500 errors… unless I did
something wrong?

Thank you,
Jesse Griffin
tummy.com, ltd.

I tried just making the changes in the Template.pm file and that did not work.
Doing that caused fatal problems, resulting in 500 errors… unless I did
something wrong?

Since you don’t show the errors, it’s impossible to know what happened
there.

The fix for this problem was updated further based on some new reports
and was merged to 4.2-trunk as
https://github.com/bestpractical/rt/commit/254e8da98a20.patch

You cannot easily apply that directly to an installed RT because of
the test file changes we made to help ensure this doesn’t happen
again.

If you patch a tarball of RT 4.2.1 and rerun configure with your old
arguments (available at the top of /opt/rt4/etc/RT_Config.pm) and make
upgrade, the patch will be applied. Since you’re keeping /opt/rt4 in
source control, it’ll be easy to see that the change was applied.

There are several ways to trick the patch command into not patching a
nonexistent t/ directory. Edit the file, removing the section patching
t/. From a git clone of RT, run
git format-patch -1 254e8da98 lib/
and you’ll get a file that only patches the two lib files.

Alternatively, wait for RT 4.2.2rc1 (announced on rt-devel) and test
once available.

-kevin

Alternatively, wait for RT 4.2.2rc1 (announced on rt-devel) and test
once available.

RT 4.2.2rc1 is now available for testing, and resolves this issue:
RT 4.2.2 Release Notes - RT: Request Tracker - Best Practical

  • Alex