MySQL error 256 when rss item with inner image

If you run tt-rss on an officially unsupported platform (shared hosting, Windows, etc.) post here
AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

MySQL error 256 when rss item with inner image

Postby AK666 » 01 Dec 2015, 20:22

How to fix this error?

And post error to error_log failed too...

PHP Fatal error: Query INSERT INTO ttrss_error_log
(errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
(256, 'Query INSERT INTO ttrss_entries\n (title,\n guid,\n link,\n updated,\n content,\n content_hash,\n no_orig_date,\n date_updated,\n date_entered,\n comments,\n num_comments,\n plugin_data,\n lang,\n author)\n VALUES\n (\'Пограничники пресекли провоз в Мариуполь двух тонн незаконной крупы\',\n \'SHA1:321e3a342cf72a747d7619d7a51e060e8f5442e7\',\n \'http://www.0629.com.ua/article/1046757\',\n \'2015/12/01 07:17:00\',\n \' На контрольном пункте \\\"Бабах-Тарама\\\" в грузовом автомобиле марки \\\"Мерседес\\\" пограничники обнаружили более 2 тонн крупы.Об этом сообщили в пресс-службе Донецко in /srv/www/ttrss/classes/db/mysqli.php on line 33


example of rss:

Code: Select all

<item>
<title>
<![CDATA[Пограничники пресекли провоз в Мариуполь двух тонн незаконной крупы]]>
</title>
<description>
<![CDATA[На контрольном пункте "Бабах-Тарама" в грузовом автомобиле марки "Мерседес" пограничники обнаружили более 2 тонн крупы]]>
</description>
<content:encoded>
<![CDATA[
 <p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA8AAAALQCAIAAADQFY7jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAwjtUlEQVR4nOy9iZJkyXUd6O5vjSWztq7uxtIASEiUZCOzkY1pxmb+/wPGbGyM4ogURQANAqiuqtwi4u3uc8+57h4vl2qgZaKEItNRiI6MePEWX8+9fu655XdDGKf5b//TX/
...

Code: Select all

ZK/xg7VcOKS1YEoZpfcHDA9buVxg/jcrTnSm4WOn40OIkdnoCFl7gbf162XFVDEsh3cg/7pX8yTG+p3wdOPeas6mETVLyS1T/sM+xg/bbiDMzVbwKfMWff0fzStRVHYeaO9AAAAAElFTkSuQmCC" alt="" /></p>
]]>
</content:encoded>
<pubDate>Tue, 01 Dec 2015 09:17:00 +0200</pubDate>
<category domain="http://www.0629.com.ua/news/cat/5">
<![CDATA[ Происшествия ]]>
</category>
</item>

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: MySQL error 256 when rss item with inner image

Postby fox » 03 Dec 2015, 16:07

hmm imported fine here on postgres

e: also on mysql

strange issues w/ escaping somehow failing were reported before, i think, but so far nobody figured out why this happens to some people

another possibility is some weird unicode stuff going on with this mysql database

AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

Re: MySQL error 256 when rss item with inner image

Postby AK666 » 22 Dec 2015, 05:24

same error on another rss

the XML <item></item> size is 3.2 Mb

I think this error when data more then [WHAT] ?

Can truncate "content" value when parsing xml and before post to the server ?
Or what I can change in php or mysql settings to put big data ?
Last edited by AK666 on 22 Dec 2015, 05:27, edited 2 times in total.

AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

Re: MySQL error 256 when rss item with inner image

Postby AK666 » 22 Dec 2015, 05:25

I cant attach file with Item to forum. "File size to big"

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: MySQL error 256 when rss item with inner image

Postby fox » 22 Dec 2015, 09:03

while it is obvious that your system is misconfigured or limited somehow this is not a general support forum so we can't really help you here

to me it looks like shared hosting issues, so even your posting in Support is questionable

AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

Re: MySQL error 256 when rss item with inner image

Postby AK666 » 22 Dec 2015, 15:38

ok, thnx.

AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

Re: MySQL error 256 when rss item with inner image

Postby AK666 » 22 Dec 2015, 16:18

solution for me (only)

/classes/article.php

Code: Select all

146                } else {
    +                     $trunc_content = mb_strimwidth($content, 0, 1000000, "...8<...");
147                        $result = db_query("INSERT INTO ttrss_entries
150 ~                                ('$title', '$guid', '$url', NOW(), '$content_hash', NOW(), NOW(), '$trunc_content')");

120
    +
121                 db_query("UPDATE ttrss_entries SET.
124 ~               ,content = '$trunc_content'



/include/rssfuncs.php

Code: Select all

858     // base post entry does not exist, create it
859
    +                                   $trunc_content = mb_strimwidth($entry_content, 0, 1000000, "...8<...");
860 ~                                   $result = db_query(
    ~                                           "INSERT INTO ttrss_entries
    ~                                                   (title,
    ~                                                   guid,
    ~                                                   link,
    ~                                                   updated,
    ~                                                   content_hash,
    ~                                                   no_orig_date,
    ~                                                   date_updated,
    ~                                                   date_entered,
    ~                                                   comments,
    ~                                                   num_comments,
    ~                                                   plugin_data,
    ~                                                   lang,
    ~                                                   author,
    ~                                                   content)
    ~                                           VALUES
    ~                                                   ('$entry_title',
    ~                                                   '$entry_guid_hashed',
    ~                                                   '$entry_link',
    ~                                                   '$entry_timestamp_fmt',
    ~                                                   '$entry_current_hash',
    ~                                                   false,
    ~                                                   NOW(),
    ~                                                   '$date_feed_processed',
    ~                                                   '$entry_comments',
    ~                                                   '$num_comments',
    ~                                                   '$entry_plugin_data',
    ~                                                   '$entry_language',
    ~                                                   '$entry_author',
    ~                                                   '$trunc_content')");


1038
    +     $trunc_content = mb_strimwidth($entry_content, 0, 1000000, "...8<...");
    +
1039     db_query("UPDATE ttrss_entries
1043 ~   content = '$trunc_content',

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: MySQL error 256 when rss item with inner image

Postby JustAMacUser » 22 Dec 2015, 19:36

Wouldn't it be easier to use a plugin that filters each article? You could find img tags whose src attribute starts with data: and remove the tag, replace the src value, or even save the image locally and change the src attribute to the new location.

e: The real solution is to find out why your MySQL install is broken. But the plugin is a much better workaround than hacking the core to arbitrarily limit the content.

AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

Re: MySQL error 256 when rss item with inner image

Postby AK666 » 23 Dec 2015, 09:56

Hi

I dont know how write|create plugin for tt-rss, but this changes is quickly for me.

If this plugin exist prompt it name please

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: MySQL error 256 when rss item with inner image

Postby JustAMacUser » 23 Dec 2015, 11:45

Umm, doesn't exist. It's just a better approach than modifying the core, which is going to be difficult to maintain during updates and creates the potential to break your install of TT-RSS down the road.

Plus, there's literally a hook that lets you modify an article's content right before inserting it into the database--it even passes a DOMDocument object for your convenience. Doesn't get better than that!

Anyway, I'm on my phone at the moment so I'm not going to be coding, but if I remember later it would be easy enough to do.

AK666
Bear Rating Trainee
Bear Rating Trainee
Posts: 7
Joined: 01 Dec 2015, 20:09

Re: MySQL error 256 when rss item with inner image

Postby AK666 » 23 Dec 2015, 13:27

I am grateful to you

But in filter necessary to provide replaces
not only

Code: Select all

img src="data:image/png;base64,

or

Code: Select all

img src="data:image/jpg;base64,


but also other very large data. And I cant see how it provide

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: MySQL error 256 when rss item with inner image

Postby fox » 23 Dec 2015, 13:44

since this thread is now about your obviously broken system, i'm moving it to unsupported subforum

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: MySQL error 256 when rss item with inner image

Postby JustAMacUser » 23 Dec 2015, 20:45

AK666 wrote:but also other very large data. And I cant see how it provide


Well your hack will almost certainly break any HTML. My proposal would not. Even if you were concerned about the overall size, it still makes more sense to hook the article filter as you can properly deal with the article in a manner that doesn't modify the software.

Humor me and run this in MySQL:

Code: Select all

SHOW CREATE TABLE ttrss_entries\G


The proper table allows content up to 4 GB and I'm curious to see if your install is using the correct schema. Also, how much memory is allocated to PHP?


Return to “Unsupported platforms”

Who is online

Users browsing this forum: No registered users and 9 guests