Mir

mir_demo_server hangs

Bug #1185183 reported by Thomi Richards
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mir
Fix Released
High
Robert Ancell

Bug Description

I have a trivial test application that reliably hangs the mir_demo_server. All it does is connect, allocate a surface, release the surface and disconnect. It tries to do this 1000 times. After 501 times, the server hangs, and any subsequent connections made will block indefinitely.

The test application is available at:

lp:~thomir/+junk/hangmir

The code is short, so I'll list it below as well:

<code>
#include <iostream>
#include <future>
#include "mir_toolkit/mir_client_library.h"
#include <unistd.h>

void hang_mir_server()
{
    std::cout << "Connecting...";
    MirConnection *connection_ = mir_connect_sync(NULL, "My App Name");

    MirDisplayInfo display_info;
    mir_connection_get_display_info(connection_, &display_info);

    MirPixelFormat const pixel_format = display_info.supported_pixel_format[0];
    MirSurfaceParameters const request_params =
        {
            __PRETTY_FUNCTION__,
            640,
            480,
            pixel_format,
            mir_buffer_usage_software
        };
    std::cout << "Create Surface...";
    MirSurface *surface_ = mir_connection_create_surface_sync(connection_, &request_params);
    std::cout << "Release Surface...";
    mir_surface_release_sync(surface_);

    MirPlatformPackage pkg;
    mir_connection_get_platform(connection_, &pkg);
    close(pkg.fd[0]);
    std::cout << "Disconnecting...";
    mir_connection_release(connection_);
    std::cout << "Done." << std::endl;
}

int main(int argc, char** argv)
{
    for (int i = 0; i < 1000; i++)
    {
        std::cout << "Iteration " << i << ": ";
        hang_mir_server();
    }
    return 0;
}

</snip>

Related branches

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Note in my case it occurred around iteration ~480.

Changed in mir:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Definitely a file descriptor leak - looking at /proc/(pid)/fd shows it locks up when 1024 file descriptors are open

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Looks like dmabuf fds being left open

bob@alchemy:~/bzr/mir$ sudo ls /proc/3389/fd -l
total 0
lrwx------ 1 root root 64 May 29 14:58 0 -> /dev/tty1
l-wx------ 1 root root 64 May 29 14:58 1 -> /home/bob/bzr/mir/mir.log
lrwx------ 1 root root 64 May 29 14:59 10 -> /dev/dri/card1
lr-x------ 1 root root 64 May 29 14:59 100 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1000 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1001 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1002 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1003 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1004 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1005 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1006 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1007 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1008 -> anon_inode:dmabuf
lr-x------ 1 root root 64 May 29 14:59 1009 -> anon_inode:dmabuf
...

Changed in mir:
milestone: none → 0.0.4
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.0.4

Changed in mir:
status: Triaged → Fix Committed
Changed in mir:
status: Fix Committed → Fix Released
Changed in mir:
assignee: nobody → Robert Ancell (robert-ancell)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.