Cloud Data Integration で「DTMプロセスが予期せず終了しました」が発生

# はじめに
Informatica Data Management Cloud の Cloud Data Integration でマッピングを実行した際に次のエラーが発生する場合があります。
![内部エラー。DTMプロセスが予期せず終了しました。Informaticaグローバルカスタマサポートにお問い合わせください。](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2253766/8de49258-41db-a0f6-a361-e025d635334e.png "内部エラー。DTMプロセスが予期せず終了しました。Informaticaグローバルカスタマサポートにお問い合わせください。")

エラーの原因は様々ですが、次の条件に当てはまる場合は共有ライブリの `libidn11` が不足している可能性が高いです。
- Secure AgentのOSはLinuxを利用している
- Secure Agentをインストールした直後から発生している

# ログを確認してみる
マッピングのセッションログを見てみます。
```session.log
Task Name: Mapping
Agent Group Id: 0xxxxxx000000000000
Agent Group Name: AGENTGROUP
Agent Name: AGENT
Agent Id: 0xxxxxxx000000000000
======================================================================
```
何も参考になるような情報は出力されていません。
次に Cloud Data Integration のtomcatログを確認してみます。

<details><summary>マッピング実行時のtomcatログ</summary>

```tomcat_xx.x.x.x.log
2023-01-15 19:40:08,903 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Received start session request for Workflow [wf_mtt_011R670Z000000000005] Session [s_mtt_011R670Z000000000005]
2023-01-15 19:40:08,904 JST INFO [com.informatica.saas.dtm.utils.FileSystemUtils] - Checking existence: /home/ubuntu/infaagent/apps/Data_Integration_Server/data/metadata
2023-01-15 19:40:08,904 JST INFO [com.informatica.saas.dtm.utils.FileSystemUtils] - Writing content to :/home/ubuntu/infaagent/apps/Data_Integration_Server/data/metadata/s_mtt_011R670Z000000000005.xml
2023-01-15 19:40:08,905 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessFileSystemImpl] - Writing parameter blob to :/home/ubuntu/infaagent/apps/Data_Integration_Server/data/parameters/s_mtt_011R670Z000000000005.param
2023-01-15 19:40:08,905 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessFileSystemImpl] - Generating parameter file content
2023-01-15 19:40:08,905 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessFileSystemImpl] - Parameter file content is generated
2023-01-15 19:40:08,909 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Submit job to thread pool queue workflow [wf_mtt_011R670Z000000000005] session [s_mtt_011R670Z000000000005]
2023-01-15 19:40:08,912 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Executing : /home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmdtm -RDTM -c /home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmrdtm.cfg -port 14221 -x /home/ubuntu/infaagent/apps/Data_Integration_Server/data/metadata/s_mtt_011R670Z000000000005.xml -s :wf_mtt_011R670Z000000000005.s_mtt_011R670Z000000000005 -p /home/ubuntu/infaagent/apps/Data_Integration_Server/data/parameters/s_mtt_011R670Z000000000005.param -lfn s_mtt_6S6rvZdW5JPkq2dGdGsZmr_7.log -lfd /home/ubuntu/infaagent/apps/Data_Integration_Server/data/../logs -il s_mtt_6S6rvZdW5JPkq2dGdGsZmr_7_import.log
2023-01-15 19:40:09,504 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Creating DTM process for workflow [wf_mtt_011R670Z000000000005] session [s_mtt_011R670Z000000000005] state:RUNNING
2023-01-15 19:40:09,505 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - DTM process started for workflow [wf_mtt_011R670Z000000000005] session [s_mtt_011R670Z000000000005] state:RUNNING
2023-01-15 19:40:09,505 JST INFO [com.informatica.saas.dtm.executor.impl.ProcessStreamReader] - [011R670Z000000000005 011R670E0000000002BL]/home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmdtm: error while loading shared libraries: libidn.so.11: cannot open shared object file: No such file or directory\n
2023-01-15 19:40:10,505 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Unmount file system for workflow [wf_mtt_011R670Z000000000005] session [s_mtt_011R670Z000000000005] state:STOPPED
2023-01-15 19:40:10,506 JST ERROR [com.informatica.saas.dtm.resource.DtmProcessCompletedRestCallback] - wf name: wf_mtt_011R670Z000000000005 monitor key: 011R670E0000000002BL exitCode: 127
2023-01-15 19:40:10,506 JST INFO [com.informatica.saas.dtm.resource.DtmProcessCompletedRestCallback] - Attempt at sending final stats to update [https://apse1.dm-ap.informaticacloud.com/saas/api/agent/v1/monitor/011R670E0000000002BL] for workflow [wf_mtt_011R670Z000000000005] session [s_mtt_011R670Z000000000005] containing DtmStats [pid=-1, workflowName=wf_mtt_011R670Z000000000005, sessionName=s_mtt_011R670Z000000000005, pdoType=null, firstError=Internal error. The DTM process terminated unexpectedly. Contact Informatica Global Customer Support., firstErrorCode=null, sourceSuccessRows=0, sourceFailedRows=0, targetSuccessRows=0, targetFailedRows=0, transformationErrors=0, runStatus=3, longRunningJob=false, transformationStats=null, performanceStats=null, sessionVariables=null, generatorValues=null, targetFileRecordIds=[], extraStats={HostTotalSockets=1, HostCpuVendor=Intel, HostCpuCoreCount=1, HostCoresPerSocket=1, HostCpumHz=2893, TaskMaxCpuCoreUsage=0.0}, longRunningTaskProcessingTimeSec=0, dtmReportedHostMachineStats=null]
2023-01-15 19:40:20,990 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Received start session request for Workflow [wf_mtt_011R670Z00000000000G] Session [s_mtt_011R670Z00000000000G]
2023-01-15 19:40:20,991 JST INFO [com.informatica.saas.dtm.utils.FileSystemUtils] - Checking existence: /home/ubuntu/infaagent/apps/Data_Integration_Server/data/metadata
2023-01-15 19:40:20,991 JST INFO [com.informatica.saas.dtm.utils.FileSystemUtils] - Writing content to :/home/ubuntu/infaagent/apps/Data_Integration_Server/data/metadata/s_mtt_011R670Z00000000000G.xml
2023-01-15 19:40:20,991 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessFileSystemImpl] - Writing parameter blob to :/home/ubuntu/infaagent/apps/Data_Integration_Server/data/parameters/s_mtt_011R670Z00000000000G.param
2023-01-15 19:40:20,991 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessFileSystemImpl] - Generating parameter file content
2023-01-15 19:40:20,992 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessFileSystemImpl] - Parameter file content is generated
2023-01-15 19:40:20,992 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Submit job to thread pool queue workflow [wf_mtt_011R670Z00000000000G] session [s_mtt_011R670Z00000000000G]
2023-01-15 19:40:20,996 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Executing : /home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmdtm -RDTM -c /home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmrdtm.cfg -port 14221 -x /home/ubuntu/infaagent/apps/Data_Integration_Server/data/metadata/s_mtt_011R670Z00000000000G.xml -s :wf_mtt_011R670Z00000000000G.s_mtt_011R670Z00000000000G -p /home/ubuntu/infaagent/apps/Data_Integration_Server/data/parameters/s_mtt_011R670Z00000000000G.param -lfn s_mtt_2Z9S45FVdiBjgPT0kB3cOh_2.log -lfd /home/ubuntu/infaagent/apps/Data_Integration_Server/data/../logs -il s_mtt_2Z9S45FVdiBjgPT0kB3cOh_2_import.log
2023-01-15 19:40:21,204 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Creating DTM process for workflow [wf_mtt_011R670Z00000000000G] session [s_mtt_011R670Z00000000000G] state:RUNNING
2023-01-15 19:40:21,204 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - DTM process started for workflow [wf_mtt_011R670Z00000000000G] session [s_mtt_011R670Z00000000000G] state:RUNNING
2023-01-15 19:40:22,205 JST INFO [com.informatica.saas.dtm.executor.impl.ProcessStreamReader] - [011R670Z00000000000G 011R670E0000000002H7]/home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmdtm: error while loading shared libraries: libidn.so.11: cannot open shared object file: No such file or directory\n
2023-01-15 19:40:22,205 JST INFO [com.informatica.saas.dtm.executor.impl.DtmProcessExecutorImpl] - Unmount file system for workflow [wf_mtt_011R670Z00000000000G] session [s_mtt_011R670Z00000000000G] state:STOPPED
2023-01-15 19:40:22,205 JST ERROR [com.informatica.saas.dtm.resource.DtmProcessCompletedRestCallback] - wf name: wf_mtt_011R670Z00000000000G monitor key: 011R670E0000000002H7 exitCode: 127
2023-01-15 19:40:22,206 JST INFO [com.informatica.saas.dtm.resource.DtmProcessCompletedRestCallback] - Attempt at sending final stats to update [https://apse1.dm-ap.informaticacloud.com/saas/api/agent/v1/monitor/011R670E0000000002H7] for workflow [wf_mtt_011R670Z00000000000G] session [s_mtt_011R670Z00000000000G] containing DtmStats [pid=-1, workflowName=wf_mtt_011R670Z00000000000G, sessionName=s_mtt_011R670Z00000000000G, pdoType=null, firstError=??????DTM????????????????Informatica?????????????????????????, firstErrorCode=null, sourceSuccessRows=0, sourceFailedRows=0, targetSuccessRows=0, targetFailedRows=0, transformationErrors=0, runStatus=3, longRunningJob=false, transformationStats=null, performanceStats=null, sessionVariables=null, generatorValues=null, targetFileRecordIds=[], extraStats={HostTotalSockets=1, HostCpuVendor=Intel, HostCpuCoreCount=1, HostCoresPerSocket=1, HostCpumHz=2893, TaskMaxCpuCoreUsage=0.0}, longRunningTaskProcessingTimeSec=0, dtmReportedHostMachineStats=null]
```
</details>

ERRORは出力されていますが、ここから原因は分からなさそうです。
```
2023-01-15 19:40:10,506 JST ERROR [com.informatica.saas.dtm.resource.DtmProcessCompletedRestCallback] - wf name: wf_mtt_011R670Z000000000005 monitor key: 011R670E0000000002BL exitCode: 127
```

ログをよく見てみると次のメッセージが出力されています。
```
2023-01-15 19:40:09,505 JST INFO [com.informatica.saas.dtm.executor.impl.ProcessStreamReader] - [011R670Z000000000005 011R670E0000000002BL]/home/ubuntu/infaagent/apps/Data_Integration_Server/64.0.6.1/ICS/main/bin/rdtm/pmdtm: error while loading shared libraries: libidn.so.11: cannot open shared object file: No such file or directory\n
```
INFOなので気づきにくいですが、`libidn.so.11`が見つからないとあります。これが原因そうです。

:::note info
ログの場所はインフォマティカ社のKnowledge Baseを参考にしてください。
[HOW TO: Informatica Cloud Secure Agent 上にあるログファイルについて](https://knowledge.informatica.com/s/article/222068?language=ja&type=external)
:::

# libidn11をインストールする

ご利用の環境に合わせてlibidnをインストールしてください。
```shell
$ sudo apt-get update
$ sudo apt-get install libidn11
```

マッピングの実行が成功しました
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2253766/69dc0ad8-5905-3f3d-dd85-e56f8860a779.png)

***
ログから気づきにくいですが、同じような症状になった場合は参考にしてください。