Project

General

Profile

Actions

Defect #39548

open

Internal Error reported when Viewing GIT repository

Added by Chris Bailey about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I am using a locally hosted redmine instance with GIT running on the same box.

In most cases the integration works between Redmine and GIT as expected but I have one repository that cannot be linked. I do not see any obvious difference between the failing repository and the working ones.

The user receives the following output:

Internal error

An error occurred on the page you were trying to access.
if you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

My installation information is:

Environment:
  Redmine version                5.0.2.stable
  Ruby version                   3.1.2-p20 (2022-04-12) [x86_64-linux]
  Rails version                  6.1.6
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
Redmine settings:
  Redmine theme                  Classic
SCM:
  Subversion                     1.14.1
  Mercurial                      5.6.1
  Bazaar                         3.1.0
  Git                            2.30.2
  Filesystem                     
Redmine plugins:
  redmine_agile                  1.6.5
  redmine_dmsf                   3.0.8
  redmine_more_previews          5.0.7

The Repository is Running with GITea which is on GIT version 2.36.4,
Based on the error (shown below) I searched the commit messages / comments for "Mov" and did find an single instance where a comment appears to have an embedded line break which is reported as follows when I do a git log:

Updated location of various Status bits in the Status message BIT section based on the recent update to the ICD. <U+2028>Moved all the input discrete bits to the 3Byte of status message (this previously only held ...

I don't see anything looking like the reported hex values (\xE2\x80\xA8)

the redmine logs show the following when the error occurs:

I, [2023-11-08T21:32:29.347197 #1]  INFO -- : Started GET "/projects/b-draft/repository/t3_software" for 10.1.10.198 at 2023-11-08 21:32:29 +0000
I, [2023-11-08T21:32:29.348562 #1]  INFO -- : Processing by RepositoriesController#show as HTML
I, [2023-11-08T21:32:29.348752 #1]  INFO -- :   Parameters: {"id"=>"b-draft", "repository_id"=>"t3_software"}
I, [2023-11-08T21:32:29.355799 #1]  INFO -- :   Current user: admin (id=1)
I, [2023-11-08T21:32:29.441451 #1]  INFO -- : Completed 500 Internal Server Error in 92ms (ActiveRecord: 16.2ms | Allocations: 25094)
F, [2023-11-08T21:32:29.443825 #1] FATAL -- :   
ActiveRecord::StatementInvalid (Mysql2::Error: Incorrect string value: '\xE2\x80\xA8Mov...' for column 'comments' at row 1):

app/models/repository/git.rb:224:in `save_revision'
app/models/repository/git.rb:212:in `block (2 levels) in save_revisions'
app/models/repository/git.rb:209:in `block in save_revisions'
app/models/repository/git.rb:208:in `each'
app/models/repository/git.rb:208:in `save_revisions'
app/models/repository/git.rb:158:in `fetch_changesets'
app/controllers/repositories_controller.rb:87:in `show'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'
plugins/redmine_dmsf/lib/redmine_dmsf/webdav/custom_middleware.rb:54:in `call'

Actions #1

Updated by Go MAEDA about 1 year ago

Is the encoding of your My SQL database utf8mb4 or utf8? The error may be due to the encoding not being utf8mb4 or utf8.

Actions #2

Updated by Chris Bailey about 1 year ago

I'm not sure how to determine the encoding of the database, it was created by Redmine when I first set up the system. I did not take any special steps.

Similarly I was looking at GIT documentation and I'm not sure how it determines the encoding of the commit messages, the repository in question is a clone of a bitbucket repository and from my reading I think the commit messages encoding is dependent on the encoding of the client used to do each commit.

Actions #3

Updated by Chris Bailey about 1 year ago

I think you are on the right track, I found some posts on how to determine the encoding with the following results:

bash-4.2# mysql -uroot -pxxx redmine -e 'SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "redmine";'
mysql: [Warning] Using a password on the command line interface can be insecure.
+----------------------------+
| default_character_set_name |
+----------------------------+
| latin1                     |
+----------------------------+
bash-4.2# mysql -uroot -pxxx redmine -e 'show variables like "char%";'                                     
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

The next question is how to fix it. I see many very old posts suggesting that this can be fixed by exporting and re-importing the database but nothing recent, Is there a "proper" way to do this?

Actions #4

Updated by Marius BÄ‚LTEANU about 1 year ago

#21398, #31921, #32140 and HowTo_convert_a_database_from_utf8_to_utf8mb4 page contain enough information to help your migrate your database to utf8mb4.

Actions #5

Updated by Chris Bailey about 1 year ago

Thanks for the feedback.

I followed the instructions and I believe the DB is now using utf8mb4:


bash-4.2# mysql -uroot -pxxxxxx redmine -e 'SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "redmine";'
mysql: [Warning] Using a password on the command line interface can be insecure.
+----------------------------+
| default_character_set_name |
+----------------------------+
| utf8mb4                    |
+----------------------------+

mysql -uroot -pxxxxxxxx redmine -e 'show variables like "char%";'                                                                     
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

but I am still getting the exact same error on this one repository.

I have deleted the repository link in the redmine settings repository page and re-addded it just in case it needed to be set up before adding the repository but the results is the same.

Actions #6

Updated by Chris Bailey about 1 year ago

I got it working. In addition to the instructions you provided above, I needed to convert the table using the following command:

ALTER TABLE changesets CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Probably need to convert all the tables but I think this fixed my specific issue.

Thanks for the support.

Actions

Also available in: Atom PDF