← Back to team overview

kernel-packages team mailing list archive

[Bug 1512815] Re: 14.04: read() from pty doesn't finish.

 

According to the dump a pair of process PID 7347 and 7348 were still
waiting for read() from /dev/ptmx (struct file ffff880c65357c00) and
/dev/pts/18 (struct file ffff880c65357500) respectively .

Normal behavior is as follows;
PID 7347: read(/dev/ptmx) -> write(/dev/ptmx),
PID 7348: write(/dev/pts/18) -> read(/dev/pts/18).

In the dump, PID 7348 finished writing to /dev/pts/18, and was waiting
for completion of reading, while PID 7347 continued waiting for reading
/dev/ptmx.

Though data has already arrived at /dev/ptmx, PID 7347 doesn't seem to
have been woken up while being linked to the queue of the data to be
read at tty_struct 0xffff88085438ac00.

- PID: 7347 TASK: ffff880853111800 CPU: 15 COMMAND: "pty"
#0 [ffff88084477dc90] __schedule at ffffffff81724e19
#1 [ffff88084477dcf8] schedule at ffffffff817252d9
#2 [ffff88084477dd08] schedule_timeout at ffffffff81724529
#3 [ffff88084477ddb8] n_tty_read at ffffffff8144f6a4
#4 [ffff88084477dec0] tty_read at ffffffff8144a94d
#5 [ffff88084477df08] vfs_read at ffffffff811bda65
#6 [ffff88084477df40] sys_read at ffffffff811be579
#7 [ffff88084477df80] system_call_fastpath at ffffffff8173196d
RIP: 00007fb735a52290 RSP: 00007fff290b4ee8 RFLAGS: 00010212
RAX: 0000000000000000 RBX: ffffffff8173196d RCX: 0000000010a8b550
RDX: 0000000000000001 RSI: 00007fff290b51af RDI: 0000000000000023
RBP: 00007fff290b51b0 R8: 00007fff290b51c0 R9: 00007fff290b5128
R10: 00007fff290b4f60 R11: 0000000000000246 R12: 00007fff290b53d0
R13: 000000000000003b R14: 0000000000000020 R15: 0000000000000010
ORIG_RAX: 0000000000000000 CS: 0033 SS: 002b

#5 [ffff88084477df08] vfs_read at ffffffff811bda65
ffff88084477df10: ffff880c65357c00 00007fff290b51af
ffff88084477df20: 0000000000000001 0000000000000000
ffff88084477df30: 000000000000001e ffff88084477df78
ffff88084477df40: ffffffff811be579

- PID: 7348 TASK: ffff88084354c800 CPU: 4 COMMAND: "pty"
#0 [ffff880844631c90] __schedule at ffffffff81724e19
#1 [ffff880844631cf8] schedule at ffffffff817252d9
#2 [ffff880844631d08] schedule_timeout at ffffffff81724529
#3 [ffff880844631db8] n_tty_read at ffffffff8144f6a4
#4 [ffff880844631ec0] tty_read at ffffffff8144a94d
#5 [ffff880844631f08] vfs_read at ffffffff811bda65
#6 [ffff880844631f40] sys_read at ffffffff811be579
#7 [ffff880844631f80] system_call_fastpath at ffffffff8173196d
RIP: 00007fb735a52290 RSP: 00007fff290b4ee8 RFLAGS: 00010206
RAX: 0000000000000000 RBX: ffffffff8173196d RCX: 000000007c9d4d40
RDX: 0000000000000001 RSI: 00007fff290b51af RDI: 0000000000000024
RBP: 00007fff290b51b0 R8: 00007fff290b51c0 R9: 00007fff290b5128
R10: 00007fff290b4f60 R11: 0000000000000246 R12: 00007fff290b53d0
R13: 000000000000003b R14: 0000000000000021 R15: 0000000000000010
ORIG_RAX: 0000000000000000 CS: 0033 SS: 002b

#5 [ffff880844631f08] vfs_read at ffffffff811bda65
ffff880844631f10: ffff880c65357500 00007fff290b51af
ffff880844631f20: 0000000000000001 0000000000000000
ffff880844631f30: 000000000000001e ffff880844631f78
ffff880844631f40: ffffffff811be579

- Files opened by PID 7347 and 7348:

FD FILE DENTRY INODE TYPE PATH tty_struct n_tty_data
....

35 ffff880c65357c00 ffff88085f5dbc80 ffff880c674e5fd8 CHR /dev/ptmx 0xffff88085438ac00 0xffffc9001edfb000
36 ffff880c65357500 ffff8808460cb8c0 ffff8808460d36c0 CHR /dev/pts/18 0xffff88085438a800 0xffffc9001edff000

# struct file->private_data(struct tty_file_private)
# struct tty_file_private->tty(struct tty_struct)
# struct tty_struct->disc_data (struct n_tty_data)

- About FD 35 (struct file ffff880c65357c00)

crash> struct tty_struct 0xffff88085438ac00
:
read_wait = {
lock = {
{
rlock = {
raw_lock = {
{
head_tail = 0x3e363e36,
tickets = {
head = 0x3e36,
tail = 0x3e36
}
}
}
}
}
},
task_list = {
next = 0xffff88084477de80,
prev = 0xffff88084477de80
}
},

crash> eval 0xffff88084477de80 - 0x18
hexadecimal: ffff88084477de68

crash> struct wait_queue_t ffff88084477de68
struct wait_queue_t {
flags = 0,
private = 0xffff880853111800, <== *
func = 0xffffffff8109a9b0 <default_wake_function>,
task_list = {
next = 0xffff88085438ae30,
prev = 0xffff88085438ae30
}
}

A task_struct of PID 7347 is linked to a read_wait queue.

crash> struct n_tty_data 0xffffc9001edfb000
struct n_tty_data {
read_head = 2795, <== *
....

raw = 1 '\001',
real_raw = 1 '\001',
icanon = 0 '\000',
push = 0 '\000',
read_tail = 2794, <== *
}

read_head - read_tail = 1 1 byte data hasn't be read.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1512815

Title:
  14.04: read() from pty doesn't finish.

Status in linux package in Ubuntu:
  New

Bug description:
  It has been brought to my attention

  By the attached test program pty, a pair of process repeats writing
  and reading only '\n' to a master pseudoterminal device (/dev/ptmx)
  and a slave pseudoterminal device (/dev/pts/N) each. When we carry out
  the following 30 pairs 10,000 times, in a pair each process doesn't
  finish reading.

  $ pty 30
  The following message will be usually indicated immediately.
  #name copy num/sec usec/num
  pty_switch 30 1541842 0.648575

  When a message wasn't indicated any more, we got the attached dump file. 
  A kernel was 3.13.0-45.74. 
  A system was Ubuntu 14.04 LTS.

  The same problem occurred in case of 3.13.0-55.92 kernel and the following kernel have been tested as well:
  2.6.32, 3.10: not reproduces.
  3.19, 4.0.0, 4.1.3: reproduces.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1512815/+subscriptions


References