chrispanag
(Christos Panagiotakopoulos)
March 7, 2021, 9:40pm
1
When I try to edit the first post of this topic I get back an HTTP 500 error code. The error logs are reporting this fatal error happening:
Message (7 copies reported)
PG::StringDataRightTruncation (ERROR: value too long for type character varying(500)
)
app/models/topic_link.rb:240:in `safe_create_topic_link'
app/models/topic_link.rb:334:in `ensure_entry_for'
app/models/topic_link.rb:128:in `block (2 levels) in extract_from'
app/models/topic_link.rb:126:in `block in extract_from'
app/models/topic_link.rb:124:in `each'
app/models/topic_link.rb:124:in `extract_from'
lib/post_revisor.rb:224:in `revise!'
app/controllers/topics_controller.rb:379:in `update'
app/controllers/application_controller.rb:358:in `block in with_resolved_locale'
app/controllers/application_controller.rb:358:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:355:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:177:in `call'
Backtrace
rack-mini-profiler (2.3.1) lib/patches/db/pg.rb:113:in `exec'
rack-mini-profiler (2.3.1) lib/patches/db/pg.rb:113:in `async_exec'
mini_sql (1.0.1) lib/mini_sql/postgres/connection.rb:201:in `run'
mini_sql (1.0.1) lib/mini_sql/postgres/connection.rb:56:in `query_single'
app/models/topic_link.rb:240:in `safe_create_topic_link'
app/models/topic_link.rb:334:in `ensure_entry_for'
app/models/topic_link.rb:128:in `block (2 levels) in extract_from'
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
activerecord (6.0.3.3) lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
Env
HTTP HOSTS: rembetiko.gr
2 Likes
sam
(Sam Saffron)
March 8, 2021, 4:31am
2
Looks like something to do with the URL, it is longer than 500 chars.
We should certainly be truncating and possibly skipping, not result in a 500.
What is the longest URL in the post?
4 Likes
chrispanag
(Christos Panagiotakopoulos)
March 8, 2021, 9:27am
3
Thanks @sam ,
the only URL the post has is from a quote. The URL is this:
https://rembetiko.gr/t/%CE%BC%CE%B1%CE%BA%CE%AC%CE%BC-%CE%B2%CF%85%CE%B6%CE%B1%CE%BD%CF%84%CE%B9%CE%BD%CE%BF%CE%AF-%CE%B4%CF%81%CF%8C%CE%BC%CE%BF%CE%B9/6034/30
2 Likes
sam
(Sam Saffron)
March 8, 2021, 9:33am
4
2 Likes
chrispanag
(Christos Panagiotakopoulos)
March 8, 2021, 9:58am
5
It has to do with the topic’s title. When I edited the topic’s title to something shorter, the errors stopped. When I try to restore it to its original length, it showed me a 500 error while updating the title. After the 500 error, I refreshed and the title was updated.
3 Likes
chrispanag
(Christos Panagiotakopoulos)
March 8, 2021, 1:21pm
6
I investigated it a bit further:
This happens on the update of the “linked” post (the one that is quoted) to include a link to the quotation. The link (because of the long title) ends up to be over 500 chars long, which triggers this issue.
The actual link on the linked post, never gets updated if the title is very long.
4 Likes
sam
(Sam Saffron)
March 8, 2021, 10:43pm
7
@Osama can you add to your list to investigate a more forgiving truncation in core, ideally you can repro in a test case.
Certainly not urgent, when you have a chance.
3 Likes
chrispanag
(Christos Panagiotakopoulos)
April 1, 2021, 8:23pm
8
Sorry to ping this, but was this bug tackled? Today, I encountered a second instance of this happening on our forum…
Thanks for all your hard work!
1 Like
sam
(Sam Saffron)
April 6, 2021, 2:52am
9
We are sadly a bit busy, it is on @Osama ’s list, hope we can get to it some time in the next 4 weeks.
4 Likes
andrei
(Andrei Prigorshnev)
June 2, 2021, 11:32am
14
@chrispanag the problem is solved now:
https://github.com/discourse/discourse/pull/13134
As you said, the error was happening when generating a backward link from the linked post to the original post if the original post had a long title.
3 Likes
chrispanag
(Christos Panagiotakopoulos)
June 4, 2021, 1:32pm
15
Thank you very much for your fix!
1 Like
sam
(Sam Saffron)
Closed
June 5, 2021, 8:00am
16
This topic was automatically closed after 2 days. New replies are no longer allowed.