# Corrupt connection file

**URL:** <https://discourse.openondemand.org/t/corrupt-connection-file/29>\
**Category:** Get Help\
**Created:** [August 21, 2018, 7:31pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29 "2018-08-21T19:31:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![azhu](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@azhu](https://discourse.openondemand.org/u/azhu)\
**Post date:** [August 21, 2018, 7:31pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29/1 "2018-08-21T19:31:54Z")

</div>

I’ve just done an initial install of OOD, and for the most part, I have it working.

However, when running an interactive desktop, I’m getting an error when  
I click on the ‘My Interactive Sessions’ button on the dashboard.

I’m seeing an ‘Internal Server Error’ with text that starts with:

```auto
#<ActionView::Template::Error: (<unknown>): invalid trailing UTF-8 octet at line 1 column 1>

/opt/rh/rh-ruby22/root/usr/share/ruby/psych.rb:370:in `parse'
/opt/rh/rh-ruby22/root/usr/share/ruby/psych.rb:370:in `parse_stream'
/opt/rh/rh-ruby22/root/usr/share/ruby/psych.rb:318:in `parse'
/opt/rh/rh-ruby22/root/usr/share/ruby/psych.rb:284:in `safe_load'
/var/www/ood/apps/sys/dashboard/app/models/batch_connect/session.rb:396:in `connect'

```

… and many more lines.

In my PUN error log file, I’m seeing similar-

```auto
App 9021 stdout: [2018-08-01 15:31:28 -0400] INFO "execve =
[{\"SLURM_CONF\"=>\"/etc/slurm/slurm.conf\"}, \"/usr/bin/squeue\",
\"--all\", \"--states=all\", \"--noconvert\", \"-o\",
\"%a\\u001F%A\\u001F%b\\u001F%B\\u001F%c\\u001F%C\\u001F%d\\u001F%D\\u001F%e\\u001F%E\\u001F%f\\u001F%F\\u001F%g\\u001F%G\\u001F%h\\u001F%H\\u001F%i\\u001F%I\\u001F%j\\u001F%J\\u001F%k\\u001F%K\\u001F%l\\u001F%L\\u001F%m\\u001F%M\\u001F%n\\u001F%N\\u001F%o\\u001F%O\\u001F%q\\u001F%P\\u001F%Q\\u001F%r\\u001F%S\\u001F%t\\u001F%T\\u001F%u\\u001F%U\\u001F%v\\u001F%V\\u001F%w\\u001F%W\\u001F%x\\u001F%X\\u001F%y\\u001F%Y\\u001F%z\\u001F%Z\",
 \"-j\", \"190\"]"

App 9021 stdout: [2018-08-01 15:31:28 -0400] INFO "method=GET
path=/pun/sys/dashboard/batch_connect/sessions format=html
controller=BatchConnect::SessionsController action=index status=500
error='ActionView::Template::Error: (<unknown>): invalid trailing
UTF-8 octet at line 1 column 1' duration=35.72 view=0.00"

App 9021 stdout: [2018-08-01 15:31:28 -0400] FATAL
"ActionView::Template::Error ((<unknown>): invalid trailing UTF-8
octet at line 1 column 1):\n 1: <%= session_panel session do %>\n
 2: <%= session_view session do %>\n 3: <%\n 4: if
session.running?\n app/models/batch_connect/session.rb:396:in
`connect'\n app/models/batch_connect/session.rb:405:in `to_hash'\n
app/helpers/batch_connect/sessions_helper.rb:3:in `session_panel'\n
app/views/batch_connect/sessions/_panel.html.erb:1:in
`_app_views_batch_connect_sessions __panel_html_erb__ 2226473861888657584_36164260'\n
 app/views/batch_connect/sessions/index.html.erb:37:in
`_app_views_batch_connect_sessions_index_html_erb__2670672794125958996_36346460'"

```

_Source: [Originally posted by Kevin M. Hildebrand in the ood-users mailing list.](https://listsprd.osu.edu/pipermail/ood-users/2018-August/000203.html)_

---

<div class="post-metadata">

**Author:** ![azhu](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@azhu](https://discourse.openondemand.org/u/azhu)\
**Post date:** [August 23, 2018, 6:48pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29/2 "2018-08-23T18:48:06Z")

</div>

It’s caused by a corrupt connection file that was generated by one of your running interactive session jobs. When an Interactive Session starts running on an allocated cluster node it will attempt to create a `connection.yml` file in its staging directory. This file holds all the necessary information (e.g., host, port, and VNC password) necessary for the user to connect back to the session through the Dashboard. The Dashboard will attempt to parse this file using the Ruby YAML parsing library `psych` and generate a link that the user can use to connect to their running session.

#### Step1: Find connection.yml file

You can find these connection files under the staging directory for each of the running Interactive Sessions. I don’t have access to my data anymore, so working from memory you can probably find it under (give or take a few mistakes in directories):

`~/ondemand/data/sys/dashboard/batch_connect/sys/bc_desktop/<cluster>/output/<unique_session_id>/connection.yml`

or you can get fancy and do:

`$ find ~/ondemand/data -name connection.yml`

#### Step2: Find and fix the bug

You will want to read the contents of those files and look for any odd characters that stand out. If you can track down the offending file that will help narrow down the bug and a possible fix.

Take the following `connection.yml` file as an example.

```auto
host: compute-0-0.xxx.yyy.zzz
port: 5902
password: �wA2XcYm
display: 2
websocket: 26532
spassword: �s�r�oym

```

It looks like whatever’s generating the passwords for VNC and Websockets is putting non-printable ASCII characters in them (which look like they’re being interpreted as UTF8, even though they’re not valid UTF8 characters.)

---

<div class="post-metadata">

**Author:** ![efranz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/efranz/32/27_2.png) [@efranz](https://discourse.openondemand.org/u/efranz)\
**Post date:** [August 30, 2018, 2:42pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29/3 "2018-08-30T14:42:31Z")

</div>

Ariel’s comment explains in detail the steps to debug the problem.

This problem occurs when connection file generated by one of the running interactive sessions is corrupt, due to non-printable ASCII characters, non valid UTF8. In this particular instance the locale on the compute node was set to ‘en\_US’ instead of ‘en\_US.UTF-8’. Since our code was using `/dev/urandom` to generate the password used in the connection file, some non UTF-8 characters were getting into the file. We changed the code used to generate passwords, addressed in [https://github.com/OSC/ood\_core/issues/91](https://github.com/OSC/ood_core/issues/91), so hopefully in OnDemand 1.4 this problem will be solved.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [July 5, 2019, 2:53pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29/4 "2019-07-05T14:53:11Z")

</div>



---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [July 8, 2019, 8:31pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29/5 "2019-07-08T20:31:15Z")

</div>



---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:19pm UTC](https://discourse.openondemand.org/t/corrupt-connection-file/29/6 "2022-05-26T15:19:29Z")

</div>


