プロジェクト

全般

プロフィール

Vote #74243

完了

JRuby: Encoding error when creating issues

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Ruby support_33
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
33
version_id:
74
issue_org_id:
14656
author_id:
63137
assigned_to_id:
0
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
72
ステータス-->[Closed]

説明

I upgraded from Redmine 1.4.4 to Redmine 2.3.2.
Redmine is built as a war using warbler-1.3.8, JRuby 1.7.2 and run on TOMCAT 7.0.37 with a JVM 1.6.31 on a RHEL 64 bit machine.
The database is a Mysql 5.5.28 and redmine tables are using a charset utf8.
We connect Redmine database with the following database.yml:

production:
   adapter: jdbc
   jndi: java:/comp/env/jdbc/Redmine
   driver: com.mysql.jdbc.Driver

We do sometime observe the following issue:

Encoding::CompatibilityError (incompatible character encodings: ASCII-8BIT and UTF-8):
  app/models/issue.rb:159:in `create_or_update'
  app/controllers/issues_controller.rb:141:in `create'

The last database log before the exception is

INFO:   Issue Load (1.0ms)  SELECT `issues`.* FROM `issues` WHERE `issues`.`root_id` IS NULL ORDER BY `rgt` desc LIMIT 1 FOR UPDATE

Note that we can create issues with all kind of strange characters both in subject and detail. But the following case:

Subject=AS400 : fonctionnement autorisation utilisation email à  revoir
Detail=Rendre pré-alimenter à l'utilisation

fails systematically. If the subject becomes "AS400 : fonctionnement autorisation utilisation" and the detail remains unchanged it works !

As a workaround we can create the issue with the subject and update it with the detail in a second step...


journals

--------------------------------------------------------------------------------
I have solved the problem by upgrading activerecord-jdbc-adapter to version 1.2.7 (this issue seems to be related to an "activerecord-jdbc-adapter":https://github.com/jruby/activerecord-jdbc-adapter/issues/229 encoding defect).
To achieve this I have modified two files:

*Gemfile*
<pre>
....
platforms :jruby do
# jruby-openssl is bundled with JRuby 1.7.0
gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
gem "activerecord-jdbc-adapter", "1.2.7"
end
....
</pre>

and *Gemfile.lock*
<pre>
.....
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-jdbc-adapter (1.2.7)
activerecord-jdbcmysql-adapter (1.2.7)
activerecord-jdbc-adapter (~> 1.2.7)
jdbc-mysql (~> 5.1.0)
....
</pre>
<pre>
DEPENDENCIES
activerecord-jdbc-adapter (= 1.2.7)
....
</pre>

Sincerly
Vincent MATHON
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Updated jdbc adapter version above 1.2.6 in Gemfile by trunk r12172 and 2.3-stable r12174.
--------------------------------------------------------------------------------


related_issues

relates,Closed,14883,Update activerecord-jdbc-adapter

Admin Redmine さんが3年以上前に更新

  • カテゴリRuby support_33 にセット
  • 対象バージョン2.3.4_74 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0