Bug 16097

Summary: race conditions at startup
Product: xorg Reporter: Felix von Leitner <felix-freedesktop>
Component: * OtherAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: NEEDINFO
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Felix von Leitner 2008-05-25 13:44:26 UTC
I am experiencing various unstable behavior at X startup.  The most annoying part of that is that the keyboard is not initialized properly.  Here is my .xinitrc:

  exec fvwm2 &
  exec xli -onroot -center -border black skyline.jpg &
  rxvt -title "Hacker Tool" -geometry 136x60

Now, fvwm complains in about 30% of the startups that X does not know the keyboard symbol for Tab and F1 and various other keys.  The result is that I have to restart fvwm to get keyboard shortcuts to work.

Every 10% of startups the xli command does not get through.  The background still stays at the default grey pattern.

rxvt does not know the Meta key in all cases.  I had to add a second line calling rxvt and now at every startup I kill the first rxvt after it appears, and the second one then knows the keys.

I tried fixing this in various ways.  I added a "sleep 1" before the first line.  Did not help.

I added an "xsleep 5 &" before the first line.  Did not help.

I am running out of options.  On my home desktop it's even worse.  There the keyboard setup fails completely and I have to run the following shell script manually and then restart fvwm and the rxvt:

  setxkbmap -rules xorg -model pc105 -layout de -option ""
  xmodmap /home/leitner/.xmodmap

If you ask me, we already lost the fight against Apple and Microsoft.  Unix was always bad, but never this bad.  Not even Sun or HP lost their keyboard setup randomly.
Comment 1 Daniel Stone 2008-05-25 14:56:19 UTC
On Sun, May 25, 2008 at 01:44:28PM -0700, bugzilla-daemon@freedesktop.org wrote:
> I am experiencing various unstable behavior at X startup.  The most annoying
> part of that is that the keyboard is not initialized properly.  Here is my
> .xinitrc:
> 
>   exec fvwm2 &
>   exec xli -onroot -center -border black skyline.jpg &
>   rxvt -title "Hacker Tool" -geometry 136x60
> 
> Now, fvwm complains in about 30% of the startups that X does not know the
> keyboard symbol for Tab and F1 and various other keys.  The result is that I
> have to restart fvwm to get keyboard shortcuts to work.
> 
> Every 10% of startups the xli command does not get through.  The background
> still stays at the default grey pattern.

Your shell script doesn't make any sense, really.

'exec' means, 'replace the current process with this command'.  This
means that having it twice is pretty pointless.

xli is a single-shot process.  That means that, if fvwm2 takes a while
to start up, xli could start and subsequently exit before fvwm2 starts.
This means that X will regenerate, including (wait for it) resetting the
background.  Passing & to xli is pointless.

Lastly, the session will close when that rxvt does, but presumably you
already knew that.

> rxvt does not know the Meta key in all cases.  I had to add a second line
> calling rxvt and now at every startup I kill the first rxvt after it appears,
> and the second one then knows the keys.
> 
> I tried fixing this in various ways.  I added a "sleep 1" before the first
> line.  Did not help.
> 
> I added an "xsleep 5 &" before the first line.  Did not help.

Um, why on earth would you put an ampersand after sleep? You're saying
'go to sleep for five seconds, but let me continue while you do it':
i.e., complete no-op.

Even if you did want to run sleep commands, it would be _after_ the fvwm
execution, not before.

> I am running out of options.  On my home desktop it's even worse.  There the
> keyboard setup fails completely and I have to run the following shell script
> manually and then restart fvwm and the rxvt:
> 
>   setxkbmap -rules xorg -model pc105 -layout de -option ""
>   xmodmap /home/leitner/.xmodmap

What do you mean 'keyboard setup fails completely'? Do you have those
options in xorg.conf? Which version of the server are you using? Can you
attach your log? What's the exact behaviour when you don't run those
commands?

> If you ask me, we already lost the fight against Apple and Microsoft.  Unix was
> always bad, but never this bad.  Not even Sun or HP lost their keyboard setup
> randomly.

What do you mean, 'we'? What have you contributed other than patronising
and insulting bug reports containing some pretty egregiously incorrect
shell scripts, to people who sacrifice sleep and many other things to
help advance free software? Sort your attitude out.
Comment 2 Felix von Leitner 2008-05-25 15:37:49 UTC
Oh boy, where do I start.  First: if you don't understand what "exec foo &" means, please do not comment on it next time.  Thanks.  It means: run foo in the background, but do not keep a forked copy of this shell around waiting for it.

Also, you obviously do not know what xsleep is but that did not keep you from commenting on it.  A small google search would have pointed you to

  http://www.acme.com/software/xsleep/

xsleep keeps a connection to X open.  The idea is to prevent exactly the effect of X restarting and reinitializing the background.  I mentioned this to rule out this as the root problem.  Also note that even if that happened, I should still see at least a flicker of it rendering the image and then refreshing it.  Which I don't.  Maybe my notebook is faster than I thought it is.

So, please go away and let someone handle the bug report who understand what he is talking about.

The keyboard setup: I get the default keyboard layout.  a-z and so on work, but Alt does not, AltGr does not (which means on a German keyboard that I cannot type \ or [ or ] or even |, which basically makes using a shell impossible.

I am using version 1.4.0 of the X server.  I tried later snapshots, they had the same problem.
Comment 3 Felix von Leitner 2008-05-26 19:25:05 UTC
OK, different theories.

First: the X server is running xkbcomp and my xinitrc in parallel, so xkbcomp is not quite finished yet when my xinitrc commands are run.

I added a "sleep 1" to the top of the xinitrc.  No effect.


Second: The X server is resetting between the commands from my xinitrc, resetting keyboard and display background.

I added an "xsleep 5 &" to the top of the xinitrc.  No effect.
I even tried adding a sleep 1 between the xsleep and the rest of xinitrc.
Did not help.

What could possibly cause this?
Comment 4 Peter Hutterer 2008-05-26 20:04:54 UTC
On Sun, May 25, 2008 at 01:44:28PM -0700, bugzilla-daemon@freedesktop.org wrote:
> I am experiencing various unstable behavior at X startup.  The most annoying
> part of that is that the keyboard is not initialized properly.  Here is my
> .xinitrc:
> 
>   exec fvwm2 &
>   exec xli -onroot -center -border black skyline.jpg &
>   rxvt -title "Hacker Tool" -geometry 136x60

this way you can't guarantee which order the commands execute. xli may connect
to the server first, disconnect before fvwm connects and thus reset the
server.

> rxvt does not know the Meta key in all cases.  I had to add a second line
> calling rxvt and now at every startup I kill the first rxvt after it appears,
> and the second one then knows the keys.

Could be related to Bug 16105. I take it you're using the keyboard to kill
rxvt?
Comment 5 Peter Hutterer 2008-09-15 23:29:36 UTC
NEEDINFO for 3 months -> INVALID

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.