Zammad: 記事の本文が大きすぎるとOTRSのインポートに失敗します

作成日 2018年07月01日  ·  9コメント  ·  ソース: zammad/zammad

こんにちは、

https://github.com/zammad/zammad/issues/1467に加えて、私はまだOTRSデータのインポートをあきらめていません。
(古いチケットは閉じることができると思います)

仕事:

zammad 2.5で、OTRSデータ(〜6000チケット)をインポートしようとしました。

結果:

1を試してください:
WebGUIを介したインポートは成功しませんでした。しばらくすると、インポートプロセスが停止しました。 タイムアウトのようなものがある可能性はありますか?

2を試してください:
コンソール経由のインポートの方が優れていましたが、本体が大きいチケット(これは添付ファイルだと思います)でインポートが失敗し、次のエラーが発生しました(以下の例外を参照してください)。 次のコマンドを実行しました。

exec railscをバンドルする

Setting.set( 'import_otrs_endpoint'、 'http://123.456.789.012/otrs/public.pl?Action = ZammadMigrator')
Setting.set( 'import_otrs_endpoint_key'、 'IhAvEaVeRySeCrEtKeY')
Setting.set( 'import_mode'、true)
Setting.set( 'system_init_done'、false)
Import :: OTRS.start

質問:

  • インポートプロセス中にソースのボディ制限を単純に上げることはできますか、それとも後でチケットにアクセスするときに問題が発生しますか?
  • または残りのチケットのインポートを再開することは可能ですか?
  • 私はあなたのdocker-composeバージョンのzammadを使用しています。 インポートドキュメントでは、「すべてのZammadプロセスを停止する」と記述します。 どのプロセス/コンテナーを停止する必要がありますか(特にDockerバージョンを使用する場合)

宜しくお願いします
MrDigit

例外のトレース:

W, [2018-07-01T12:58:20.356829 #76]  WARN -- : zammad-memcached:11211 failed (count: 0) RuntimeError: Already writing to socket
/opt/zammad/app/models/ticket/article.rb:301:in `check_body': body if article is to large, 3702347 chars - only 1500000 allowed (Exceptions::UnprocessableEntity)
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:413:in `block in make_lambda'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:197:in `block (2 levels) in halting'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:601:in `block (2 levels) in default_terminator'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:600:in `catch'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:600:in `block in default_terminator'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:198:in `block in halting'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:507:in `block in invoke_before'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:507:in `each'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:507:in `invoke_before'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:130:in `run_callbacks'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:827:in `_run_create_callbacks'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/callbacks.rb:340:in `_create_record'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/timestamp.rb:95:in `_create_record'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/persistence.rb:559:in `create_or_update'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/callbacks.rb:336:in `block in create_or_update'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:131:in `run_callbacks'
        from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/callbacks.rb:336:in `create_or_update'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/persistence.rb:129:in `save'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/validations.rb:44:in `save'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/attribute_methods/dirty.rb:35:in `save'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:308:in `block (2 levels) in save'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
        from /usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:210:in `transaction'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:308:in `block in save'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/transactions.rb:307:in `save'
        from /usr/local/bundle/gems/activerecord-5.1.5/lib/active_record/suppressor.rb:42:in `save'
        from /opt/zammad/lib/import/otrs/article.rb:64:in `create'
        from /opt/zammad/lib/import/otrs/article.rb:49:in `create_or_update'
        from /opt/zammad/lib/import/otrs/article.rb:37:in `import'
        from /opt/zammad/lib/import/otrs/article.rb:31:in `initialize'
        from /opt/zammad/lib/import/base_factory.rb:35:in `new'
        from /opt/zammad/lib/import/base_factory.rb:35:in `create_instance'
        from /opt/zammad/lib/import/base_factory.rb:11:in `block in import_action'
        from /opt/zammad/lib/import/base_factory.rb:39:in `each'
        from /opt/zammad/lib/import/base_factory.rb:39:in `import_loop'
        from /opt/zammad/lib/import/base_factory.rb:9:in `import_action'
        from /opt/zammad/lib/import/otrs/ticket.rb:40:in `import'
        from /opt/zammad/lib/import/otrs/ticket.rb:30:in `initialize'
        from /opt/zammad/lib/import/base_factory.rb:35:in `new'
        from /opt/zammad/lib/import/base_factory.rb:35:in `create_instance'
        from /opt/zammad/lib/import/base_factory.rb:11:in `block in import_action'
        from /opt/zammad/lib/import/base_factory.rb:39:in `each'
        from /opt/zammad/lib/import/base_factory.rb:39:in `import_loop'
        from /opt/zammad/lib/import/base_factory.rb:9:in `import_action'
        from /opt/zammad/lib/import/otrs.rb:147:in `import_action'
        from /opt/zammad/lib/import/otrs.rb:137:in `imported?'
        from /opt/zammad/lib/import/otrs.rb:101:in `block (3 levels) in threaded_import'
        from /opt/zammad/lib/import/otrs.rb:95:in `loop'
        from /opt/zammad/lib/import/otrs.rb:95:in `block (2 levels) in threaded_import'
        from /usr/local/bundle/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
bug import verified

全てのコメント9件

こんにちは@MrDigit 、どのDBを使用しますか? DBから制限されていると思います。ログの次の行を参照してください。

/opt/zammad/app/models/ticket/article.rb:301:in check_body': body if article is to large, 3702347 chars - only 1500000 allowed (Exceptions::UnprocessableEntity) from /usr/local/bundle/gems/activesupport-5.1.5/lib/active_support/callbacks.rb:413:inblock in make_lambda'

こんにちは@NeverMin

制限はarticle.rbにハードコードされているため、このエラーは選択したDBバックエンドとは無関係です。
制限= 1_500_000 、以下を参照)

def check_body
    return true if body.blank?
    limit = 1_500_000
    current_length = body.length
    return true if body.length <= limit

    raise Exceptions::UnprocessableEntity, "body if article is to large, #{current_length} chars - only #{limit} allowed" if !ApplicationHandleInfo.postmaster?

    logger.warn "WARNING: cut string because of database length #{self.class}.body(#{limit} but is #{current_length})"
    self.body = body[0, limit]
end

こんにちは@MrDigit 、はい、修正(例:4_000_000)して試すことができますが、Zammadに使用するDBはどれですか? MySQLまたはpostgresql? OTRSバージョンとは何ですか?

こんにちは@NeverMin

すでに制限をより高い値に引き上げましたが、インポートは後で機能しました。 問題は、制限が1.5Mバイトに設定されている理由です。 より大きなボディが格納されている場合、zammadは爆発するので、これは単に任意の値ですか?

あなたの質問について:私が使用しているzammadのdocker-composeバージョン(https://github.com/zammad/zammad-docker-compose)はpostgresqlを使用しており、添付ファイルをファイルシステムに保存しています。 OTRSはバージョン5です。

こんにちは@MrDigit 、良い質問です

JFI: https

編集:
この問題をコミュニティに移動できますか?

こんにちは@MrDigit

問題は、制限が1.5Mバイトに設定されている理由です。

この値は古く、おそらく時代遅れだと思います。 それを深く掘り下げ、問題を解決し、ここで共有していただきありがとうございます。 この問題に対処する際には、詳しく見ていきます。

これはOTRSインポートのみに限定されません。
これはいくつかのポイントで発生します。

これを再現しようとすると、15000文字でもエラーが発生し続けます(注:UIが気に入らなかったため、ここでAPIに切り替える必要がありました)。

F, [2019-07-03T16:36:15.330582 #18433-86302140] FATAL -- :
F, [2019-07-03T16:36:15.330620 #18433-86302140] FATAL -- : actionpack (5.1.7) lib/action_dispatch/http/parameters.rb:115:in `rescue in parse_formatted_parameters'
actionpack (5.1.7) lib/action_dispatch/http/parameters.rb:109:in `parse_formatted_parameters'
actionpack (5.1.7) lib/action_dispatch/http/request.rb:361:in `block in POST'
rack (2.0.7) lib/rack/request.rb:59:in `fetch'
rack (2.0.7) lib/rack/request.rb:59:in `fetch_header'
actionpack (5.1.7) lib/action_dispatch/http/request.rb:360:in `POST'
actionpack (5.1.7) lib/action_dispatch/http/parameters.rb:53:in `parameters'
actionpack (5.1.7) lib/action_dispatch/http/filter_parameters.rb:41:in `filtered_parameters'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:21:in `process_action'
actionpack (5.1.7) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
activerecord (5.1.7) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.7) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.7) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.7) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.7) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:844:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/builder.rb:64:in `call'
rack (2.0.7) lib/rack/etag.rb:25:in `call'
rack (2.0.7) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.7) lib/rack/head.rb:12:in `call'
rack (2.0.7) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.7) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/cookies.rb:613:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.7) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.7) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.7) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.7) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.7) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.7) lib/rack/method_override.rb:22:in `call'
rack (2.0.7) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
railties (5.1.7) lib/rails/engine.rb:522:in `call'
railties (5.1.7) lib/rails/railtie.rb:185:in `public_send'
railties (5.1.7) lib/rails/railtie.rb:185:in `method_missing'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
logging (2.2.2) lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

API応答が空です。

Zammadがペイロードを受け取らないため、APIを上記の制限までプッシュすることはできませんでした。

私は1500001文字(私のブラウザはすでにあまり好きではありませんでした)で試し、その後15000文字を減らしました(この値はZammad内に貼り付け可能です)。 しかし、繰り返しになりますが、記事が大きくなりすぎると、ペーストの摂取が停止します。

ただし、 1500001は1.5MBではなく、約1.14MBであり、これも制限ではありません。 約494320文字(プレーンテキスト!)を貼り付けることができますが、その後も手動入力は機能します。 成功しなかった場合は、さらに感謝します。

試行中にこのジェネレーターを使用しました: https

こんにちは、
私は制限を非難しました、そしてこの問題は制限の理由です:
https://github.com/zammad/zammad/issues/1390

私の側からは1.5MBで大丈夫です...通常、大きなコンテンツは問題のない添付ファイルで処理されます。

私は同じ問題に遭遇しました。 顧客は、記事を壊したdocxが埋め込まれたotrs記事のインポートに失敗しました(35kチケットのうちの1つ)。 使用可能なコンテンツがありません。メールサーバー/クライアントが配信中にコンテンツを壊したようです。

インポート時に発生しないように例外を変更しますので、他の場合と同様に1.5MBにカットしてインポートします。 また、1.14MB-> 1.5MBの制限を修正する必要があります。 インポートはスムーズに実行され、例外が発生しないようにする必要があります。

1記事あたり150万文字の制限を維持することにしました。 @MrGenerationが指摘したように、とにかく(はるかに少ない)

このページは役に立ちましたか?
0 / 5 - 0 評価