Sys_open problem

Hi Everybody,
i'm using solaris 7 with 64 bit kernel, and i'm trying to intercept some system calls, so i wrote a kernel module that replaces the sys_open call as a test, it compiles and loads ok and i can see it initializes using some cmn_err prints to xconsole.
as far as i understand it replaces the sys_open call (i used sysent[SYS_open].sy_callc = new_open;)
but there are some problems:
1. i put a print in the new_open call but it never gets there.
2. when i try to use truss with a command that calls open, the kernel panics.
and a question:
what is the meaning of the loadable and loaded flags in the sysent structure ?
Oren
please reply to: [email protected]

Hello,
Are you saying System Preferences doesn't open, or the Desktop pref pane doesn't work?
Bootup holding CMD+r, or the Option/alt key to boot from the Restore partition & use Disk Utility from there to Repair the Disk, then Repair Permissions.
Reboot & see if there's any change.

Similar Messages

  • Problem with boot / new install system ond SSD

    Hi guys,
    I have fresh installed system on my new SSD. I use my old HDD as external usb drive.
    I have problem with boot when I dont have connected HDD to usb.
    My system boot only to console no to KDE. When I connect external HDD to usb and reboot system, system boot normally.
    Logs after boot.
    Feb 26 16:46:39 arch systemd[1]: Reached target Login Prompts.
    Feb 26 16:46:39 arch systemd[1]: Starting K Display Manager...
    Feb 26 16:46:39 arch systemd[1]: Started K Display Manager.
    Feb 26 16:46:39 arch systemd-logind[231]: New seat seat0.
    Feb 26 16:46:39 arch systemd[1]: Started Login Service.
    Feb 26 16:46:40 arch kernel: microcode: CPU0 sig=0x1067a, pf=0x80, revision=0xa07
    Feb 26 16:46:40 arch kernel: platform microcode: Direct firmware load failed with error -2
    Feb 26 16:46:40 arch kernel: platform microcode: Falling back to user helper
    Feb 26 16:46:40 arch kernel: random: nonblocking pool is initialized
    Feb 26 16:46:40 arch kernel: uvcvideo: Found UVC 1.00 device CNF7129 (04f2:b071)
    Feb 26 16:46:40 arch laptop-mode[271]: enabled, not active
    Feb 26 16:46:40 arch kernel: input: CNF7129 as /devices/pci0000:00/0000:00:1a.7/usb3/3-3/3-3:1.0/input/input16
    Feb 26 16:46:40 arch kernel: usbcore: registered new interface driver uvcvideo
    Feb 26 16:46:40 arch kernel: USB Video Class driver (1.1.1)
    Feb 26 16:46:40 arch systemd[1]: Started Wicd a wireless and wired network manager for Linux.
    Feb 26 16:46:40 arch systemd[1]: Starting Network.
    Feb 26 16:46:40 arch systemd[1]: Reached target Network.
    Feb 26 16:46:40 arch systemd[1]: Starting OpenSSH Daemon...
    Feb 26 16:46:40 arch systemd[1]: Started OpenSSH Daemon.
    Feb 26 16:46:40 arch systemd[1]: Starting NoMachine Server daemon...
    Feb 26 16:46:40 arch sshd[373]: Server listening on 0.0.0.0 port 22.
    Feb 26 16:46:40 arch sshd[373]: Server listening on :: port 22.
    Feb 26 16:46:40 arch mtp-probe[404]: checking bus 7, device 2: "/sys/devices/pci0000:00/0000:00:1d.1/usb7/7-2"
    Feb 26 16:46:40 arch mtp-probe[404]: bus: 7, device: 2 was not an MTP device
    Feb 26 16:46:40 arch kernel: hidraw: raw HID events driver (C) Jiri Kosina
    Feb 26 16:46:40 arch kernel: usbcore: registered new interface driver usbhid
    Feb 26 16:46:40 arch kernel: usbhid: USB HID core driver
    Feb 26 16:46:40 arch systemd[1]: Starting Sound Card.
    Feb 26 16:46:40 arch systemd[1]: Reached target Sound Card.
    Feb 26 16:46:40 arch systemd-udevd[145]: renamed network interface eth0 to enp3s0
    Feb 26 16:46:40 arch kernel: psmouse serio4: elantech: assuming hardware version 2 (with firmware version 0x040101)
    Feb 26 16:46:40 arch kernel: psmouse serio4: elantech: Synaptics capabilities query result 0x7e, 0x13, 0x0d.
    Feb 26 16:46:40 arch kernel: i915 0000:00:02.0: irq 45 for MSI/MSI-X
    Feb 26 16:46:40 arch kernel: [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    Feb 26 16:46:40 arch kernel: [drm] Driver supports precise vblank timestamp query.
    Feb 26 16:46:40 arch kernel: vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
    Feb 26 16:46:40 arch kernel: iTCO_vendor_support: vendor-support=0
    Feb 26 16:46:40 arch kernel: iTCO_wdt: Intel TCO WatchDog Timer Driver v1.10
    Feb 26 16:46:40 arch kernel: iTCO_wdt: Found a ICH9M TCO device (Version=2, TCOBASE=0x0860)
    Feb 26 16:46:40 arch kernel: iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
    Feb 26 16:46:40 arch kernel: input: ETPS/2 Elantech Touchpad as /devices/platform/i8042/serio4/input/input15
    Feb 26 16:46:40 arch systemd-logind[231]: Watching system buttons on /dev/input/event2 (Lid Switch)
    Feb 26 16:46:40 arch systemd-logind[231]: Watching system buttons on /dev/input/event1 (Sleep Button)
    Feb 26 16:46:40 arch systemd-logind[231]: Watching system buttons on /dev/input/event3 (Power Button)
    Feb 26 16:46:41 arch kernel: microcode: CPU1 sig=0x1067a, pf=0x80, revision=0xa07
    Feb 26 16:46:41 arch kernel: platform microcode: Direct firmware load failed with error -2
    Feb 26 16:46:41 arch kernel: platform microcode: Falling back to user helper
    Feb 26 16:46:41 arch kernel: input: 2.4G Wireless Wireless Receiver as /devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.0/input/input17
    Feb 26 16:46:41 arch kernel: hid-generic 0003:1915:0F01.0001: input,hidraw0: USB HID v1.11 Keyboard [2.4G Wireless Wireless Receiver ] on usb-0000:00:1d.1-2/input0
    Feb 26 16:46:41 arch kernel: input: 2.4G Wireless Wireless Receiver as /devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.1/input/input18
    Feb 26 16:46:41 arch kernel: hid-generic 0003:1915:0F01.0002: input,hidraw1: USB HID v1.11 Mouse [2.4G Wireless Wireless Receiver ] on usb-0000:00:1d.1-2/input1
    Feb 26 16:46:41 arch kernel: BUG: unable to handle kernel NULL pointer dereference at (null)
    Feb 26 16:46:41 arch kernel: IP: [<ffffffffa06c1317>] mousedev_open_device+0x77/0x100 [mousedev]
    Feb 26 16:46:41 arch kernel: PGD b650b067 PUD b650a067 PMD 0
    Feb 26 16:46:41 arch kernel: Oops: 0000 [#1] PREEMPT SMP
    Feb 26 16:46:41 arch kernel: Modules linked in: mousedev(+) hid_generic iTCO_wdt iTCO_vendor_support ath9k(+) usbhid ath9k_common hid ath9k_hw ath uvcvideo mac80211 microcode(+) videobuf2_vmalloc videobuf2_memops videobuf2_core videodev media evdev psmouse serio_raw pcspkr cfg80211 lpc_ich i915(+) atl1e snd_hda_codec_via snd_hda_intel drm_kms_helper snd_hda_codec drm snd_hwdep snd_pcm snd_page_alloc i2c_algo_bit i2c_core snd_timer asus_laptop snd battery ac soundcore sparse_keymap acpi_cpufreq rfkill video input_polldev thermal intel_agp intel_gtt shpchp processor button ext4 crc16 mbcache jbd2 sr_mod cdrom sd_mod atkbd libps2 ahci libahci libata scsi_mod ehci_pci uhci_hcd ehci_hcd usbcore usb_common i8042 serio
    Feb 26 16:46:41 arch kernel: CPU: 1 PID: 227 Comm: acpid Not tainted 3.13.5-1-ARCH #1
    Feb 26 16:46:41 arch kernel: Hardware name: ASUSTeK Computer Inc. K50IJ /K50IJ , BIOS 217 12/04/2009
    Feb 26 16:46:41 arch kernel: task: ffff88007ffeda00 ti: ffff8800b6516000 task.ti: ffff8800b6516000
    Feb 26 16:46:41 arch kernel: RIP: 0010:[<ffffffffa06c1317>] [<ffffffffa06c1317>] mousedev_open_device+0x77/0x100 [mousedev]
    Feb 26 16:46:41 arch kernel: RSP: 0018:ffff8800b6517c10 EFLAGS: 00010202
    Feb 26 16:46:41 arch kernel: RAX: 0000000000000000 RBX: ffff8801390f5800 RCX: ffff8801390f5868
    Feb 26 16:46:41 arch kernel: RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000246
    Feb 26 16:46:41 arch kernel: RBP: ffff8800b6517c28 R08: 0000000000000000 R09: ffff88013b001600
    Feb 26 16:46:41 arch kernel: R10: 0000000000000000 R11: 0000000000000004 R12: 0000000000000000
    Feb 26 16:46:41 arch kernel: R13: ffff8801390f5880 R14: ffff8800b3287558 R15: ffff880138c8f600
    Feb 26 16:46:41 arch kernel: FS: 00007f8de7e14700(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000
    Feb 26 16:46:41 arch kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    Feb 26 16:46:41 arch kernel: CR2: 0000000000000000 CR3: 00000000b6507000 CR4: 00000000000407e0
    Feb 26 16:46:41 arch kernel: Stack:
    Feb 26 16:46:41 arch kernel: ffff88013926e400 ffff8801390f5800 ffff8801390f5878 ffff8800b6517c60
    Feb 26 16:46:41 arch kernel: ffffffffa06c20cc ffff8801390f5b48 ffff8800b3287558 ffff880138c8f600
    Feb 26 16:46:41 arch kernel: ffffffffa06c2e80 ffff880138c8f610 ffff8800b6517c98 ffffffff811a834f
    Feb 26 16:46:41 arch kernel: Call Trace:
    Feb 26 16:46:41 arch kernel: [<ffffffffa06c20cc>] mousedev_open+0xcc/0x150 [mousedev]
    Feb 26 16:46:41 arch kernel: [<ffffffff811a834f>] chrdev_open+0x9f/0x1d0
    Feb 26 16:46:41 arch kernel: [<ffffffff811a19e7>] do_dentry_open+0x1b7/0x2c0
    Feb 26 16:46:41 arch kernel: [<ffffffff811aedc1>] ? __inode_permission+0x41/0xb0
    Feb 26 16:46:41 arch kernel: [<ffffffff811a82b0>] ? cdev_put+0x30/0x30
    Feb 26 16:46:41 arch kernel: [<ffffffff811a1e01>] finish_open+0x31/0x40
    Feb 26 16:46:41 arch kernel: [<ffffffff811b1bf2>] do_last+0x572/0xe90
    Feb 26 16:46:41 arch kernel: [<ffffffff811af0b6>] ? link_path_walk+0x236/0x8d0
    Feb 26 16:46:41 arch kernel: [<ffffffff811b25cb>] path_openat+0xbb/0x6b0
    Feb 26 16:46:41 arch kernel: [<ffffffff811b3cda>] do_filp_open+0x3a/0x90
    Feb 26 16:46:41 arch kernel: [<ffffffff811c05c7>] ? __alloc_fd+0xa7/0x130
    Feb 26 16:46:41 arch kernel: [<ffffffff811a2fd4>] do_sys_open+0x124/0x220
    Feb 26 16:46:41 arch kernel: [<ffffffff811a30ee>] SyS_open+0x1e/0x20
    Feb 26 16:46:41 arch kernel: [<ffffffff8152142d>] system_call_fastpath+0x1a/0x1f
    Feb 26 16:46:41 arch kernel: Code: c0 6e e5 e0 5b 44 89 e0 41 5c 41 5d 5d c3 66 0f 1f 44 00 00 4c 89 ef 41 bc ed ff ff ff e8 a2 6e e5 e0 eb e0 48 8b 15 c9 21 00 00 <8b> 02 8d 48 01 85 c0 89 0a 75 c6 48 8b 05 37 1f 00 00 48 3d 60
    Feb 26 16:46:41 arch kernel: RIP [<ffffffffa06c1317>] mousedev_open_device+0x77/0x100 [mousedev]
    Feb 26 16:46:41 arch kernel: RSP <ffff8800b6517c10>
    Feb 26 16:46:41 arch kernel: CR2: 0000000000000000
    Feb 26 16:46:41 arch kernel: ---[ end trace 76aa0cbb67cf77f6 ]---
    Feb 26 16:46:41 arch kernel: microcode: Microcode Update Driver: v2.00 <[email protected]>, Peter Oruba
    Feb 26 16:46:41 arch systemd[1]: acpid.service: main process exited, code=killed, status=9/KILL
    Feb 26 16:46:41 arch systemd[1]: Unit acpid.service entered failed state.
    Feb 26 16:46:41 arch kernel: [drm] GMBUS [i915 gmbus dpc] timed out, falling back to bit banging on pin 4
    Feb 26 16:46:41 arch systemd[1]: Started Laptop Mode Tools.
    Feb 26 16:46:41 arch nxserver[374]: NX> 161 Enabled service: nxserver.
    Feb 26 16:46:42 arch kernel: fbcon: inteldrmfb (fb0) is primary device
    Feb 26 16:46:42 arch kernel: ath: phy0: Enable LNA combining
    Feb 26 16:46:42 arch kernel: ath: EEPROM regdomain: 0x60
    Feb 26 16:46:42 arch kernel: ath: EEPROM indicates we should expect a direct regpair map
    Feb 26 16:46:42 arch kernel: ath: Country alpha2 being used: 00
    Feb 26 16:46:42 arch kernel: ath: Regpair used: 0x60
    Feb 26 16:46:42 arch kernel: ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
    Feb 26 16:46:42 arch kernel: ieee80211 phy0: Atheros AR9285 Rev:2 mem=0xffffc90011e80000, irq=17
    Feb 26 16:46:42 arch systemd-udevd[139]: renamed network interface wlan0 to wlp2s0
    Feb 26 16:46:42 arch kernel: Console: switching to colour frame buffer device 170x48
    Feb 26 16:46:42 arch kernel: i915 0000:00:02.0: fb0: inteldrmfb frame buffer device
    Feb 26 16:46:42 arch kernel: i915 0000:00:02.0: registered panic notifier
    Feb 26 16:46:42 arch kernel: ACPI: Video Device [VGA] (multi-head: yes rom: no post: no)
    Feb 26 16:46:42 arch kernel: acpi device:38: registered as cooling_device2
    Feb 26 16:46:42 arch kernel: input: Video Bus as /devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:00/input/input19
    Feb 26 16:46:42 arch nxserver[374]: NX> 161 Enabled service: nxnode.
    Feb 26 16:46:42 arch nxserver[374]: NX> 161 Enabled service: nxd.
    Feb 26 16:46:42 arch systemd[1]: Started NoMachine Server daemon.
    Feb 26 16:46:42 arch systemd[1]: Starting Multi-User System.
    Feb 26 16:46:42 arch systemd[1]: Reached target Multi-User System.
    Feb 26 16:46:42 arch systemd[1]: Starting Graphical Interface.
    Feb 26 16:46:42 arch systemd[1]: Reached target Graphical Interface.
    Feb 26 16:46:42 arch systemd[1]: Startup finished in 1.241s (kernel) + 3.231s (userspace) = 4.473s.
    Feb 26 16:46:46 arch kernel: IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
    Feb 26 16:46:48 arch kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
    Feb 26 16:46:49 arch wicd[226]: dhcpcd[1383]: dhcpcd not running
    Feb 26 16:46:49 arch dhcpcd[1383]: dhcpcd not running
    Feb 26 16:46:49 arch kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
    Feb 26 16:46:49 arch wicd[226]: Failed to connect to non-global ctrl_ifname: wlp2s0 error: No such file or directory
    Feb 26 16:46:49 arch wicd[226]: dhcpcd[1389]: dhcpcd not running
    Feb 26 16:46:49 arch dhcpcd[1389]: dhcpcd not running
    Feb 26 16:46:49 arch kernel: IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
    Feb 26 16:46:49 arch wicd[226]: Failed to connect to non-global ctrl_ifname: enp3s0 error: No such file or directory
    Feb 26 16:46:49 arch wicd[226]: dhcpcd[1397]: dhcpcd not running
    Feb 26 16:46:49 arch dhcpcd[1397]: dhcpcd not running
    Feb 26 16:46:49 arch kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
    Feb 26 16:46:49 arch wicd[226]: Failed to connect to non-global ctrl_ifname: wlp2s0 error: No such file or directory
    Feb 26 16:46:51 arch systemd[1]: Starting Getty on tty2...
    Feb 26 16:46:51 arch systemd[1]: Started Getty on tty2.
    Feb 26 16:46:52 arch kernel: wlp2s0: authenticate with 08:86:3b:7f:86:08
    Feb 26 16:46:52 arch kernel: wlp2s0: send auth to 08:86:3b:7f:86:08 (try 1/3)
    Feb 26 16:46:52 arch kernel: wlp2s0: authenticated
    Feb 26 16:46:52 arch kernel: ath9k 0000:02:00.0 wlp2s0: disabling HT/VHT due to WEP/TKIP use
    Feb 26 16:46:52 arch kernel: wlp2s0: associate with 08:86:3b:7f:86:08 (try 1/3)
    Feb 26 16:46:52 arch kernel: wlp2s0: RX AssocResp from 08:86:3b:7f:86:08 (capab=0x411 status=0 aid=4)
    Feb 26 16:46:52 arch kernel: wlp2s0: associated
    Feb 26 16:46:52 arch kernel: IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
    Feb 26 16:46:53 arch dhcpcd[1416]: version 6.2.1 starting
    Feb 26 16:46:54 arch dhcpcd[1416]: DUID 00:01:00:01:1a:96:a5:70:1c:4b:d6:a2:1f:ad
    Feb 26 16:46:54 arch dhcpcd[1416]: wlp2s0: IAID d6:a2:1f:ad
    Feb 26 16:46:54 arch dhcpcd[1416]: wlp2s0: soliciting an IPv6 router
    Feb 26 16:46:54 arch dhcpcd[1416]: wlp2s0: ipv6nd_sendrsprobe: sendmsg: Cannot assign requested address
    Feb 26 16:46:54 arch dhcpcd[1416]: wlp2s0: rebinding lease of 192.168.2.3
    Feb 26 16:46:55 arch kernel: type=1006 audit(1393429615.096:2): pid=1406 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=1 res=1
    Feb 26 16:46:55 arch login[1406]: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
    Feb 26 16:46:55 arch systemd[1]: Starting user-0.slice.
    Feb 26 16:46:55 arch systemd[1]: Created slice user-0.slice.
    Feb 26 16:46:55 arch systemd[1]: Starting User Manager for 0...
    Feb 26 16:46:55 arch kernel: type=1006 audit(1393429615.106:3): pid=1477 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=2 res=1
    Feb 26 16:46:55 arch systemd[1]: Starting Session 1 of user root.
    Feb 26 16:46:55 arch systemd[1]: Started Session 1 of user root.
    Feb 26 16:46:55 arch systemd-logind[231]: New session 1 of user root.
    Feb 26 16:46:55 arch systemd[1477]: pam_unix(systemd-user:session): session opened for user root by (uid=0)
    Feb 26 16:46:55 arch login[1406]: ROOT LOGIN ON tty2
    Feb 26 16:46:55 arch systemd[1477]: Failed to open private bus connection: Failed to connect to socket /run/user/0/dbus/user_bus_socket: No such file or directory
    Feb 26 16:46:55 arch systemd[1477]: Mounted /sys/kernel/config.
    Feb 26 16:46:55 arch systemd[1477]: Stopped target Sound Card.
    Feb 26 16:46:55 arch systemd[1477]: Starting Default.
    Feb 26 16:46:55 arch systemd[1477]: Reached target Default.
    Feb 26 16:46:55 arch systemd[1477]: Startup finished in 7ms.
    Feb 26 16:46:55 arch systemd[1]: Started User Manager for 0.
    Feb 26 16:46:59 arch dhcpcd[1416]: wlp2s0: leased 192.168.2.3 for 283824000 seconds
    Feb 26 16:46:59 arch dhcpcd[1416]: wlp2s0: adding route to 192.168.2.0/24
    Feb 26 16:46:59 arch dhcpcd[1416]: wlp2s0: adding default route via 192.168.2.1
    Feb 26 16:46:59 arch dhcpcd[1416]: forked to background, child pid 1522
    Feb 26 16:47:10 arch kdm[238]: X server startup timeout, terminating
    Feb 26 16:47:12 arch systemd-udevd[131]: worker [140] /devices/pci0000:00/0000:00:02.0 timeout; kill it
    Feb 26 16:47:12 arch systemd-udevd[131]: seq 1255 '/devices/pci0000:00/0000:00:02.0' killed
    Feb 26 16:47:12 arch systemd-udevd[131]: worker [146] /devices/platform/i8042/serio4/input/input15 timeout; kill it
    Feb 26 16:47:12 arch systemd-udevd[131]: seq 1659 '/devices/platform/i8042/serio4/input/input15' killed
    Feb 26 16:47:12 arch systemd-udevd[131]: worker [148] /devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.1/input/input18 timeout; kill it
    Feb 26 16:47:12 arch systemd-udevd[131]: seq 1679 '/devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.1/input/input18' killed
    Feb 26 16:47:12 arch kernel: [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
    Feb 26 16:47:12 arch systemd-udevd[131]: worker [140] terminated by signal 9 (Killed)
    Feb 26 16:47:12 arch systemd-udevd[131]: worker [148] terminated by signal 9 (Killed)
    Feb 26 16:47:12 arch systemd[1]: Starting Load/Save Screen Backlight Brightness of acpi_video0...
    Feb 26 16:47:12 arch systemd[1]: Started Load/Save Screen Backlight Brightness of acpi_video0.
    Feb 26 16:47:12 arch kernel: input: failed to attach handler mousedev to device input15, error: -4
    Feb 26 16:47:12 arch systemd-udevd[131]: worker [146] terminated by signal 9 (Killed)
    Feb 26 16:47:12 arch kernel: input: failed to attach handler mousedev to device input18, error: -4
    Feb 26 16:47:12 arch kernel: mousedev: PS/2 mouse device common for all mice
    Feb 26 16:47:13 arch kdm[238]: X server for display :0 cannot be started, session disabled
    Feb 26 16:48:56 arch kernel: usb 7-2: USB disconnect, device number 2
    Feb 26 16:48:56 arch laptop-mode[1782]: Laptop mode
    Feb 26 16:48:56 arch laptop-mode[1783]: enabled, not active
    Feb 26 16:48:56 arch laptop-mode[1834]: Laptop mode
    [xx@arch Desktop]$ uname -a
    Linux arch 3.13.5-1-ARCH #1 SMP PREEMPT Sun Feb 23 00:25:24 CET 2014 x86_64 GNU/Linux
    Could you please someone help me with this?
    Thanks

    Sorry to bump this, but I'm having the exact same error tonight on my HTPC, any chance you found out what the problem was ?
    To make matters worse, it's not happening every single time, but maybe every 4 out of 5 boots (same kernel, no changes in between.)
    I thought this was a kernel issue related to this:
    https://lkml.org/lkml/2014/3/10/359
    I've tried adding atkbd and psmouse to my mkinitcpio.conf MODULES section and rebuilt, but no change.
    I changed the NVidia driver from nvidia-304xx to nvidia-full-beta-all ( 334.21 ) from AUR but it had the same error at the same place.
    Here's the part from `dmesg` where it borks:
    [ 3.229195] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:04.0-3/input2
    [ 3.236312] input: Logitech Unifying Device. Wireless PID:400e as /devices/pci0000:00/0000:00:04.0/usb3/3-3/3-3:1.2/0003:046D:C52B.0003/input/input6
    [ 3.237230] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:400e] on usb-0000:00:04.0-3:1
    [ 3.279150] BUG: unable to handle kernel NULL pointer dereference at (null)
    [ 3.280083] IP: [<ffffffffa1cbc317>] mousedev_open_device+0x77/0x100 [mousedev]
    [ 3.280810] PGD c99ea067 PUD c9f4a067 PMD 0
    [ 3.281266] Oops: 0000 [#1] PREEMPT SMP
    [ 3.281668] Modules linked in: mousedev(+) nvidia(PO+) snd_hda_codec_realtek hid_logitech_dj usbhid hid usb_storage coretemp evdev microcode pcspkr serio_raw snd_hda_intel(+) snd_hda_codec shpchp snd_hwdep snd_pcm snd_page_alloc snd_timer snd soundcore i2c_nforce2 i2c_core wmi processor button r8169 mii ext4 crc16 mbcache jbd2 sd_mod ata_generic pata_acpi ahci libahci libata ohci_pci ohci_hcd ehci_pci ehci_hcd scsi_mod usbcore usb_common psmouse atkbd libps2 i8042 serio
    [ 3.281820] CPU: 1 PID: 211 Comm: acpid Tainted: P O 3.13.6-1-ARCH #1
    [ 3.281820] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./MCP7A-ION, BIOS 080015 10/10/2009
    [ 3.281820] task: ffff8800ca5c1b00 ti: ffff8800c97f0000 task.ti: ffff8800c97f0000
    [ 3.281820] RIP: 0010:[<ffffffffa1cbc317>] [<ffffffffa1cbc317>] mousedev_open_device+0x77/0x100 [mousedev]
    [ 3.281820] RSP: 0018:ffff8800c97f1c10 EFLAGS: 00010202
    [ 3.281820] RAX: 0000000000000000 RBX: ffff8800c9987000 RCX: ffff8800c9987068
    [ 3.281820] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000246
    [ 3.281820] RBP: ffff8800c97f1c28 R08: 0000000000000000 R09: ffff8800cf401600
    [ 3.281820] R10: 0000000000000000 R11: 0000000000000004 R12: 0000000000000000
    [ 3.281820] R13: ffff8800c9987080 R14: ffff8800c0260058 R15: ffff8800c9f2a500
    [ 3.281820] FS: 00007f8f12f05700(0000) GS:ffff8800cfa80000(0000) knlGS:0000000000000000
    [ 3.281820] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 3.281820] CR2: 0000000000000000 CR3: 00000000ca93e000 CR4: 00000000000007e0
    [ 3.281820] Stack:
    [ 3.281820] ffff8800c9940000 ffff8800c9987000 ffff8800c9987078 ffff8800c97f1c60
    [ 3.281820] ffffffffa1cbd0cc ffff8800c9987348 ffff8800c0260058 ffff8800c9f2a500
    [ 3.281820] ffffffffa1cbde80 ffff8800c9f2a510 ffff8800c97f1c98 ffffffff811a83ef
    [ 3.392372] Call Trace:
    [ 3.398245] [<ffffffffa1cbd0cc>] mousedev_open+0xcc/0x150 [mousedev]
    [ 3.398245] [<ffffffff811a83ef>] chrdev_open+0x9f/0x1d0
    [ 3.398245] [<ffffffff811a1a87>] do_dentry_open+0x1b7/0x2c0
    [ 3.398245] [<ffffffff811aee61>] ? __inode_permission+0x41/0xb0
    [ 3.398245] [<ffffffff811a8350>] ? cdev_put+0x30/0x30
    [ 3.398245] [<ffffffff811a1ea1>] finish_open+0x31/0x40
    [ 3.398245] [<ffffffff811b1c92>] do_last+0x572/0xe90
    [ 3.398245] [<ffffffff811af156>] ? link_path_walk+0x236/0x8d0
    [ 3.398245] [<ffffffff811b266b>] path_openat+0xbb/0x6b0
    [ 3.508083] random: nonblocking pool is initialized
    [ 3.398245] [<ffffffff811b3d7a>] do_filp_open+0x3a/0x90
    [ 3.398245] [<ffffffff811c0617>] ? __alloc_fd+0xa7/0x130
    [ 3.398245] [<ffffffff811a3074>] do_sys_open+0x124/0x220
    [ 3.398245] [<ffffffff811a318e>] SyS_open+0x1e/0x20
    [ 3.398245] [<ffffffff815216ad>] system_call_fastpath+0x1a/0x1f
    [ 3.556729] Code: 40 c1 85 df 5b 44 89 e0 41 5c 41 5d 5d c3 66 0f 1f 44 00 00 4c 89 ef 41 bc ed ff ff ff e8 22 c1 85 df eb e0 48 8b 15 c9 21 00 00 <8b> 02 8d 48 01 85 c0 89 0a 75 c6 48 8b 05 37 1f 00 00 48 3d 60
    [ 3.556729] RIP [<ffffffffa1cbc317>] mousedev_open_device+0x77/0x100 [mousedev]
    [ 3.556729] RSP <ffff8800c97f1c10>
    [ 3.556729] CR2: 0000000000000000
    [ 3.563412] ---[ end trace 590b482a8704c6ac ]---
    [ 3.980300] input: HDA NVidia HDMI/DP,pcm=3 Phantom as /devices/pci0000:00/0000:00:08.0/sound/card0/input7
    Here's the output on a good boot:
    [ 3.415791] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:04.0-3/input2
    [ 3.422256] input: Logitech Unifying Device. Wireless PID:400e as /devices/pci0000:00/0000:00:04.0/usb3/3-3/3-3:1.2/0003:046D:C52B.0003/input/input6
    [ 3.422644] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:400e] on usb-0000:00:04.0-3:1
    [ 3.434861] mousedev: PS/2 mouse device common for all mice
    [ 3.853639] input: HDA NVidia HDMI/DP,pcm=3 Phantom as /devices/pci0000:00/0000:00:08.0/sound/card0/input7
    Here's my mkinitcpio.conf
    : grep -v ^\# /etc/mkinitcpio.conf
    MODULES="atkbd psmouse"
    BINARIES=""
    FILES=""
    HOOKS="base udev autodetect modconf block filesystems keyboard fsck"
    Last edited by corpdecker (2014-03-19 02:47:30)

  • [usb_modeswitch] Problem connecting my Huawei E173

    Hello Everyone,
    I bought an Huawei E173 3G usb pen to use with my netbook when I'm not at home but I've found some problems with the connection of this one with Arch Linux.
    The only way for the E173 to work properly is to put it in the computer and then boot Arch Linux (if I suspend, or even remove the 3g pen it becames nearly impossiblie to connect again).
    Some useful information :
    lsusb (when working) --> Bus 001 Device 009: ID 12d1:1c05 Huawei Technologies Co., Ltd.
    lsusb (when not working) --> Bus 001 Device 009: ID 12d1:1c0b Huawei Technologies Co., Ltd.
    I've found this line on the /lib/udev/rules.d/40-usb_modeswitch.rules :
    # Huawei E173
    ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1557", RUN+="usb_modeswitch '%b/%k'"
    # Huawei E173s
    ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c0b", RUN+="usb_modeswitch '%b/%k'"
    When the E173 is connected the Vendor ID is 12d1 and the Product ID 1c0b, and the E173 isn't found by Network Manager, then the Product ID changes to 1c05, only after that Network Manager detectes the USB and I can connect.
    The problem is that, after disconnecting or suspending (or even when I connect on my USB3.0 port on my netbook), the Product ID stay's at 1c0b and I can't connect at all... not even "sudo usb_modeswitch -v 12d1 -p 1c0b -R" helps.
    Sometimes when I connect the E173 and the switch is done, my screen turns black with text on it showing a sort of "kernel panic".. I just have to touch one key and I can use normaly my system... this is what it shows :
    Mar 19 00:10:50 localhost kernel: [ 1833.946597] usb 1-1: reset high-speed USB device number 12 using ehci_hcd
    Mar 19 00:10:59 localhost kernel: [ 1842.696113] usb 1-1: USB disconnect, device number 12
    Mar 19 00:11:06 localhost kernel: [ 1850.423200] usb 1-1: new high-speed USB device number 13 using ehci_hcd
    Mar 19 00:11:07 localhost kernel: [ 1850.772937] scsi34 : usb-storage 1-1:1.0
    Mar 19 00:11:07 localhost kernel: [ 1850.773598] scsi35 : usb-storage 1-1:1.1
    Mar 19 00:11:10 localhost kernel: [ 1853.535573] scsi 35:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
    Mar 19 00:11:10 localhost kernel: [ 1853.535935] scsi 34:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
    Mar 19 00:11:10 localhost kernel: [ 1853.539648] sr0: scsi-1 drive
    Mar 19 00:11:10 localhost kernel: [ 1853.540368] sd 35:0:0:0: [sdb] Attached SCSI removable disk
    Mar 19 00:11:10 localhost kernel: [ 1853.540617] sr 34:0:0:0: Attached scsi CD-ROM sr0
    Mar 19 00:11:10 localhost kernel: [ 1853.549361] usb 1-1: USB disconnect, device number 13
    Mar 19 00:11:10 localhost kernel: [ 1853.554768] scsi 35:0:0:0: killing request
    Mar 19 00:11:10 localhost kernel: [ 1853.555339] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
    Mar 19 00:11:10 localhost kernel: [ 1853.555523] IP: [<ffffffffa030c0f5>] sd_revalidate_disk+0x35/0x1c90 [sd_mod]
    Mar 19 00:11:10 localhost kernel: [ 1853.555682] PGD 60078067 PUD 60245067 PMD 0
    Mar 19 00:11:10 localhost kernel: [ 1853.555768] Oops: 0000 [#1] PREEMPT SMP
    Mar 19 00:11:10 localhost kernel: [ 1853.555846] CPU 3
    Mar 19 00:11:10 localhost kernel: [ 1853.555881] Modules linked in: option usb_wwan usbserial sr_mod cdrom joydev snd_hda_codec_realtek snd_hda_intel snd_hda_codec uvcvideo videodev snd_hwdep snd_pcm snd_page_alloc snd_timer snd soundcore iTCO_wdt v4l2_compat_ioctl32 media mxm_wmi i2c_i801 iTCO_vendor_support serio_raw atl1c eeepc_wmi asus_wmi pci_hotplug sparse_keymap usb_storage uas psmouse pcspkr wmi thermal evdev processor battery ac lib80211_crypt_tkip wl(P) lib80211 cfg80211 rfkill bbswitch(O) ext4 crc16 jbd2 mbcache sd_mod xhci_hcd uhci_hcd ahci libahci libata scsi_mod ehci_hcd usbcore usb_common i915 video button i2c_algo_bit intel_agp intel_gtt drm_kms_helper drm i2c_core [last unloaded: nvidia]
    Mar 19 00:11:10 localhost kernel: [ 1853.557150]
    Mar 19 00:11:10 localhost kernel: [ 1853.557181] Pid: 2424, comm: udevd Tainted: P O 3.2.11-1-ARCH #1 ASUSTeK Computer INC. 1215N/1215N
    Mar 19 00:11:10 localhost kernel: [ 1853.557352] RIP: 0010:[<ffffffffa030c0f5>] [<ffffffffa030c0f5>] sd_revalidate_disk+0x35/0x1c90 [sd_mod]
    Mar 19 00:11:10 localhost kernel: [ 1853.557514] RSP: 0018:ffff8800603d9a28 EFLAGS: 00010246
    Mar 19 00:11:10 localhost kernel: [ 1853.557600] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
    Mar 19 00:11:10 localhost kernel: [ 1853.557711] RDX: 0000000000000000 RSI: ffff88004e51d740 RDI: ffff88006036e000
    Mar 19 00:11:10 localhost kernel: [ 1853.557824] RBP: ffff8800603d9ae8 R08: 0000000800000000 R09: 00000008ffffffff
    Mar 19 00:11:10 localhost kernel: [ 1853.557936] R10: 0000000000000001 R11: ffffc90000203000 R12: ffff88006036e000
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] R13: 00000000ffffff85 R14: ffff88007958d198 R15: ffff88006036e000
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] FS: 00007f59f01f0740(0000) GS:ffff88007f580000(0000) knlGS:0000000000000000
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] CR2: 0000000000000008 CR3: 00000000518cf000 CR4: 00000000000006e0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] Process udevd (pid: 2424, threadinfo ffff8800603d8000, task ffff88007a1c1c80)
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] Stack:
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] ffff8800603d9a78 ffffffff81181dd4 ffffffff81865820 ffffffff8119ddc0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] ffffffff81238959 ffff88006036e048 0000000000000000 00000000ffffff85
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] ffff8800603d9a98 ffffffff81169a63 ffff88006036e000 ffff88007958d278
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] Call Trace:
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81181dd4>] ? iget5_locked+0x94/0x1f0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8119ddc0>] ? bdev_test+0x20/0x20
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81238959>] ? kobject_release+0x59/0xa0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81169a63>] ? get_super+0x73/0xd0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81181f78>] ? iput+0x48/0x210
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff811d3f3a>] rescan_partitions+0xaa/0x4d0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8119f72e>] __blkdev_get+0x2ce/0x430
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8119f8e3>] blkdev_get+0x53/0x310
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81180c66>] ? unlock_new_inode+0x56/0x80
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8119e79f>] ? bdget+0x11f/0x140
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8119fbfd>] blkdev_open+0x5d/0x80
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81165690>] __dentry_open+0x310/0x3f0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8119fba0>] ? blkdev_get+0x310/0x310
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff811735b0>] ? do_lookup+0x50/0x3d0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff811669a1>] nameidata_to_filp+0x71/0x80
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81176bc5>] do_last+0x185/0x970
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff811774c2>] path_openat+0xd2/0x3c0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8112d764>] ? handle_mm_fault+0x1b4/0x350
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff811778d2>] do_filp_open+0x42/0xa0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81183fdc>] ? alloc_fd+0xec/0x140
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81166aa7>] do_sys_open+0xf7/0x1d0
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff81166ba0>] sys_open+0x20/0x30
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] [<ffffffff8145ddc2>] system_call_fastpath+0x16/0x1b
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] Code: 41 54 53 48 81 ec 98 00 00 00 66 66 66 66 90 48 8b 9f 40 03 00 00 31 d2 65 48 8b 04 25 28 00 00 00 48 89 45 c8 31 c0 48 89 7d 90 <4c> 8b 7b 08 41 8b 87 80 06 00 00 83 f8 04 0f 95 c2 83 f8 06 0f
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] RIP [<ffffffffa030c0f5>] sd_revalidate_disk+0x35/0x1c90 [sd_mod]
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] RSP <ffff8800603d9a28>
    Mar 19 00:11:10 localhost kernel: [ 1853.558030] CR2: 0000000000000008
    Mar 19 00:11:10 localhost kernel: [ 1853.626835] ---[ end trace b93a56f621410389 ]---
    Mar 19 00:11:15 localhost kernel: [ 1859.206527] usb 1-1: new high-speed USB device number 14 using ehci_hcd
    Mar 19 00:11:16 localhost kernel: [ 1859.736586] option 1-1:1.0: GSM modem (1-port) converter detected
    Mar 19 00:11:16 localhost kernel: [ 1859.736924] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
    Mar 19 00:11:16 localhost kernel: [ 1859.737272] option 1-1:1.1: GSM modem (1-port) converter detected
    Mar 19 00:11:16 localhost kernel: [ 1859.737537] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
    Mar 19 00:11:16 localhost kernel: [ 1859.737828] option 1-1:1.2: GSM modem (1-port) converter detected
    Mar 19 00:11:16 localhost kernel: [ 1859.738079] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
    Mar 19 00:11:16 localhost kernel: [ 1859.738530] scsi36 : usb-storage 1-1:1.3
    Mar 19 00:11:16 localhost kernel: [ 1859.739107] scsi37 : usb-storage 1-1:1.4
    Mar 19 00:11:18 localhost kernel: [ 1862.320701] scsi 36:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
    Mar 19 00:11:18 localhost kernel: [ 1862.321331] scsi 37:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
    Mar 19 00:11:18 localhost kernel: [ 1862.323904] sr0: scsi-1 drive
    Mar 19 00:11:18 localhost kernel: [ 1862.324715] sr 36:0:0:0: Attached scsi CD-ROM sr0
    Mar 19 00:11:18 localhost kernel: [ 1862.326462] sd 37:0:0:0: [sdb] Attached SCSI removable disk
    How can I solve this problem ?
    PS : Sorry for my bad english.
    Thanks in Advance,
    Luis Da Costa
    Last edited by aliasbody (2012-03-19 00:16:10)

    My early 2009 iMAC was connected to a 1 TB Time Capsule via ethernet cable. To improve my internet speed that cable now connects the iMAC to my cable modem.
    The network speed through the TC should be just as fast as direct to the cable modem.. if it is poor then the TC is likely damaged or faulty.. Please tell me exactly the model number.
    A1xxx from the base.. eg A1355 is gen3.
    See Looking for Model # on Time Capsule
    The early TC are known to go faulty which will make them useless for your purposes as well.
    I've tried to connect the Time Capsule to the iMAC via USB cable
    No, this is not possible.. the TC is a network drive now and forevermore.
    and wifi (via a new NetGear router) without success.
    Wifi might work but the setup is going to be messy. You will need to deliberately control the IP setup.
    See this post. Using Time Capsule hardwired to Mac for back-up only.
    BUT it is a poor setup still .. the TC is not going to give you either speed or reliability when using wireless.
    In fact on a 2009 iMac the best solution for backup is a USB or FW800 drive. USB 2 is very far from fast but it is still faster than TC even over ethernet.. and on a 2009 model the FW800 is the best interface you have.. although it is a dead duck now.

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • J2ME problem with threads

    Hi all,
    I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
    Below you can find the code
    import java.lang.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class intervals extends MIDlet implements CommandListener
    public Display ekran;
    private SweepCanvas sweeper;
    private Form rundy;
    private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
    private long czas,x;
    private Command exitCommand;
    private Command addRound;
    private Command delRound;
    private Command start;
    private TextField repeat;
    private Form odliczanie;
    private Alert ostrz;
    Licznik thread;
    String test;
    StringItem test1;
    int parz,i,j,k;
    static int l;
    int ilrund;
    int ilpowt;
    Item sec;
    long sec1;
    public intervals()
        rundy = new Form("Interwa&#322;y sportowe");
        exitCommand = new Command("Wyj&#347;cie", Command.EXIT, 2);
        addRound = new Command("Dodaj","Dodaj rund&#281;", Command.ITEM,1);
        delRound = new Command("Usu&#324;","Usu&#324; ostatni&#261; rund&#281;", Command.ITEM,1);
        start = new Command("Start", Command.ITEM,1);
        odliczanie = new Form("Odliczanie");
        TextField dodaj(TextField kolej)
            kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
            if(rundy.size()==0)
                rundy.insert(rundy.size(),kolej);
                else
                    rundy.insert(rundy.size()-1, kolej);
            return kolej;
        void odliczanie(TextField round)
            monitor m=new monitor();
            k=Integer.parseInt(round.getString());
            ekran.setCurrent(odliczanie);
            thread=new Licznik(k,odliczanie);
            thread.start();
            ekran.setCurrent(rundy);
    public void startApp()// throws MIDletStateChangeException
        rundy.deleteAll();
        repeat = new TextField("Podaj ilo&#347;&#263; powtórze&#324;",null,1,TextField.NUMERIC);
        rundy.addCommand(addRound);
        rundy.addCommand(exitCommand);
        rundy.setCommandListener(this);
        Canvas obrazek = new MyCanvas();
        ekran = Display.getDisplay(this);
        ekran.setCurrent(obrazek);
        czas=System.currentTimeMillis();
        while (System.currentTimeMillis()<czas+1000)
            continue;
        ekran.setCurrent(rundy);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
        notifyDestroyed();
    public void commandAction(Command c, Displayable s)
        if (c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
        else if(c==addRound)
            if(rundy.size()==0)//Sprawdzenie ilo&#347;ci elementów w celu poprawnego wy&#347;wietlania liczby rund w formie
                parz=1;
                else
                parz=rundy.size();
            switch(parz)
                case 1:
                    round0=dodaj(round0);break;
                case 2:
                    round1=dodaj(round1);break;
                case 3:
                   round2= dodaj(round2);break;
                case 4:
                    round3=dodaj(round3);break;
                case 5:
                    round4=dodaj(round4);break;
                default:
                    ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
                    ostrz.setTimeout(3000);
                    ekran.setCurrent(ostrz);
            if(rundy.size()==1)
                rundy.append(repeat);
                rundy.addCommand(start);
            rundy.addCommand(delRound);
        else if(c==delRound)
            if(rundy.size()!=0)
                rundy.delete(rundy.size()-2);
                if (rundy.size()==1)
                    rundy.deleteAll();
                if(rundy.size()==0)
                    rundy.removeCommand(delRound);
                    rundy.removeCommand(start);
        else if(c==start)
            ilrund=rundy.size()-1;
            if(this.repeat.size()>0)
                ilpowt=Integer.parseInt(this.repeat.getString());
            ekran = Display.getDisplay(this);
            for (i=1; i<=ilpowt;i++)
                odliczanie= new Form("Odliczanie");
                 for (j=0;j<ilrund;j++)
                    switch(j)
                         case 0:
                             odliczanie(round0);
                             break;
                         case 1:
                             odliczanie(round1);
                             break;
                         case 2:
                             odliczanie(round2);
                             break;
                         case 3:
                             odliczanie(round3);
                             break;
                         case 4:
                             odliczanie(round4);
                             break;
                         case 5:
                             odliczanie(round5);
                             break;
                         case 6:
                             odliczanie(round6);
                             break;
                         case 7:
                             odliczanie(round7);
                             break;
                         case 8:
                             odliczanie(round8);
                             break;
    class Licznik extends Thread
        int czas1,k;
        Form forma;
        monitor m;
        public Licznik(int k,Form formap)
            czas1=k;
            forma=formap;
        public synchronized void run()
            while(czas1>0)
                forma.deleteAll();
                forma.append("Czas pozosta&#322;y (s): "+czas1);
                try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
                czas1--;
            if(czas1<=0)
                m.put();
        }and monitor class
    public class monitor
    boolean busy=false;
    synchronized void get()
        if(!busy)
            try
                wait();
            }catch(InterruptedException e){e.printStackTrace();}
        notify();
    synchronized void put()
        if(busy)
            try
            wait();
            }catch(InterruptedException e){e.printStackTrace();}
        busy=true;
        notify();
    }Can anybody help me with this?

    Groovemaker,
    Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
    If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
    Daniel

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Problem with threads running javaw

    Hi,
    Having a problem with multi thread programming using client server sockets. The program works find when starting the the application in a console using java muti.java , but when using javaw multi.java the program doesnt die and have to kill it in the task manager. The program doesnt display any of my gui error messages either when the server disconnect the client. all works find in a console. any advice on this as I havent been able to understand why this is happening? any comment would be appreciated.
    troy.

    troy,
    Try and post a minimum code sample of your app which
    does not work.
    When using javaw, make sure you redirect the standard
    error and standard output streams to file.
    Graeme.Hi Graeme,
    I dont understand what you mean by redirection to file? some of my code below.
    The code works fine under a console, code is supposed to exit when the client (the other server )disconnects. the problem is that but the clientworker side of the code still works. which under console it doesnt.
    public class Server{
    ServerSocket aServerSocket;
    Socket dianosticsSocket;
    Socket nPortExpress;
    ClientListener aClientListener;
    LinkedList queue = new LinkedList();
    int port = 0;
    int clientPort = 0;
    String clientName = null;
    boolean serverAlive = true;
    * Server constructor generates a server
    * Socket and then starts a client threads.
    * @param aPort      socket port of local machine.
    public Server(int aPort, String aClientName, int aClientPort){
    port = aPort;
    clientName = aClientName;
    clientPort = aClientPort;
    try{
    // create a new thread
    aServerSocket = new ServerSocket(port) ;
    // connect to the nPortExpress
    aClientListener = new ClientListener(InetAddress.getByName(clientName), clientPort, queue,this);
    // aClientListener.setDaemon(true);
    aClientListener.start();
    // start a dianostic port
    DiagnosticsServer aDiagnosticsServer = new DiagnosticsServer(port,queue,aClientListener);
    // System.out.println("Server is running on port " + port + "...");
    // System.out.println("Connect to nPort");
    catch(Exception e)
    // System.out.println("ERROR: Server port " + port + " not available");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Server port " + port + " not available", JOptionPane.ERROR_MESSAGE);
    serverAlive = false;
    System.exit(1);
    while(serverAlive&&aClientListener.hostSocket.isConnected()){
    try{
    // connect the client
    Socket aClient = aServerSocket.accept();
    //System.out.println("open client connection");
    //System.out.println("client local: "+ aClient.getLocalAddress().toString());
    // System.out.println("client localport: "+ aClient.getLocalPort());
    // System.out.println("client : "+ aClient.getInetAddress().toString());
    // System.out.println("client port: "+ aClient.getLocalPort());
    // make a new client thread
    ClientWorker clientThread = new ClientWorker(aClient, queue, aClientListener, false);
    // start thread
    clientThread.start();
    catch(Exception e)
    //System.out.println("ERROR: Client connection failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client connection failure", JOptionPane.ERROR_MESSAGE);
    }// end while
    } // end constructor Server
    void serverExit(){
         JOptionPane.showMessageDialog(null, "Server ","ERROR: nPort Failure", JOptionPane.ERROR_MESSAGE);
         System.exit(1);
    }// end class Server
    *** connect to another server
    public class ClientListener extends Thread{
    InetAddress hostName;
    int hostPort;
    Socket hostSocket;
    BufferedReader in;
    PrintWriter out;
    boolean loggedIn;
    LinkedList queue;      // reference to Server queue
    Server serverRef; // reference to main server
    * ClientListener connects to the host server.
    * @param aHostName is the name of the host eg server name or IP address.
    * @param aHostPort is a port number of the host.
    * @param aLoginName is the users login name.
    public ClientListener(InetAddress aHostName, int aHostPort,LinkedList aQueue,Server aServer)      // reference to Server queue)
    hostName = aHostName;
    hostPort = aHostPort;
    queue = aQueue;
    serverRef = aServer;      
    // connect to the server
    try{
    hostSocket = new Socket(hostName, hostPort);
    catch(IOException e){
    //System.out.println("ERROR: Connection Host Failed");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort Failed", JOptionPane.ERROR_MESSAGE);     
    System.exit(0);
    } // end constructor ClientListener
    ** multi client connection server
    ClientWorker(Socket aSocket,LinkedList aQueue, ClientListener aClientListener, boolean diagnostics){
    queue = aQueue;
    addToQueue(this);
    client = aSocket;
    clientRef = aClientListener;
    aDiagnostic = diagnostics;
    } // end constructor ClientWorker
    * run method is the main loop of the server program
    * in change of handle new client connection as well
    * as handle all messages and errors.
    public void run(){
    boolean alive = true;
    String aSubString = "";
    in = null;
    out = null;
    loginName = "";
    loggedIn = false;
    while (alive && client.isConnected()&& clientRef.hostSocket.isConnected()){
    try{
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
    if(aDiagnostic){
    out.println("WELCOME to diagnostics");
    broadCastDia("Connect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    out.println("WELCOME to Troy's Server");
    broadCastDia("Connect : client "+client.getInetAddress().toString());
         out.flush();
    String line;
    while(((line = in.readLine())!= null)){
    StringTokenizer aStringToken = new StringTokenizer(line, " ");
    if(!aDiagnostic){
    broadCastDia(line);
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    else{
    if(line.equals("GETIPS"))
    getIPs();
    else{
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    } // end while
    catch(Exception e){
    // System.out.println("ERROR:Client Connection reset");
                             JOptionPane.showMessageDialog(null, (e.toString()),"ERROR:Client Connection reset", JOptionPane.ERROR_MESSAGE);     
    try{
    if(aDiagnostic){
    broadCastDia("Disconnect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    broadCastDia("Disconnect : client "+client.getInetAddress().toString());
         out.flush();
    // close the buffers and connection;
    in.close();
    out.close();
    client.close();
    // System.out.println("out");
    // remove from list
    removeThreadQueue(this);
    alive = false;
    catch(Exception e){
    // System.out.println("ERROR: Client Connection reset failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client Connection reset failure", JOptionPane.ERROR_MESSAGE);     
    }// end while
    } // end method run
    * method run - Generates io stream for communicating with the server and
    * starts the client gui. Run also parses the input commands from the server.
    public void run(){
    boolean alive = true;
    try{
    // begin to life the gui
    // aGuiClient = new ClientGui(hostName.getHostName(), hostPort, loginName, this);
    // aGuiClient.show();
    in = new BufferedReader(new InputStreamReader(hostSocket.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(hostSocket.getOutputStream()));
    while (alive && hostSocket.isConnected()){
    String line;
    while(((line = in.readLine())!= null)){
    System.out.println(line);
    broadCast(line);
    } // end while
    } // end while
    catch(Exception e){
    //     System.out.println("ERRORa Connection to host reset");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort reset", JOptionPane.ERROR_MESSAGE);
    try{
    hostSocket.close();
         }catch(Exception a){
         JOptionPane.showMessageDialog(null, (a.toString()),"ERROR: Exception", JOptionPane.ERROR_MESSAGE);
    alive = false;
    System.exit(1);
    } // end method run

  • Problem with Threads and "plase wait..."-Window

    Hi everyone,
    I have a problem that I'm not able to solve in any way... I have a time-consuming task (a file decryption) which I execute in a separate thread; I've used the SwingWorker class, like suggested by sun-tutorial, and it works right. The problem is that I have to wait that the decryption have finished before continuing with program-execution. Therefore I would like to display a "please wait"-window while the task runs. I've tryed all the possible ways I know but the problem is always the same: the waitWindow is displayed empty, the bounds are painted but the contents no; it's only painted when the decrypt-task has finished. Please help me, I have no more resources....
    decrypt-file code:
    public class DecryptFile {
      private String cryptedFileNameAndPath;
      private ByteArrayInputStream resultStream = null;
      // need for progress
      private int lengthOfTask;
      private int current = -1;
      private String statMessage;
      public DecryptFile(String encZipFileNameAndPath) {
        cryptedFileNameAndPath = encZipFileNameAndPath;
        //Compute length of task...
        // 0 for indeterminate
        lengthOfTask = 0;
      public ByteArrayInputStream getDecryptedInputStream() {
        return this.resultStream;
       * Called from ProgressBarDemo to start the task.
      public void go() {
        current = -1;
        final SwingWorker worker = new SwingWorker() {
          public Object construct() {
            return new ActualTask();
        worker.start();
       * Called from ProgressBarDemo to find out how much work needs
       * to be done.
      public int getLengthOfTask() {
        return lengthOfTask;
       * Called from ProgressBarDemo to find out how much has been done.
      public int getCurrent() {
        return current;
      public void stop() {
        current = lengthOfTask;
       * Called from ProgressBarDemo to find out if the task has completed.
      public boolean done() {
        if (current >= lengthOfTask)
          return true;
        else
          return false;
      public String getMessage() {
        return statMessage;
       * The actual long running task.  This runs in a SwingWorker thread.
      class ActualTask {
        ActualTask () {
          current = -1;
          statMessage = "";
          resultStream = AIUtil.getInputStreamFromEncZip(cryptedFileNameAndPath); //here the decryption happens
          current = 0;
          statMessage = "";
      }The code that calls decryption and displays waitWindow
          final WaitSplash wS = new WaitSplash("Please wait...");
          final DecryptFile cryptedTemplate = new DecryptFile (this.templateFile);
          cryptedTemplate.go();
          while (! cryptedTemplate.done()) {
            try {
              wait();
            } catch (Exception e) { }
          this.templateInputStream = cryptedTemplate.getDecryptedInputStream();
          wS.close();Thanks, thanks, thanks in advance!
    Edoardo

    Maybe you can try setting the priority of the long-running thread to be lower? so that the UI will be more responsive...

  • Problem with threads in j2me

    im using jdk 1.6 with java wtk 2.1
    ya i know..
    2.1 is a jdk1.4 source
    but im using souce as 1.4 during compiliation so thats not the prob
    this is my code
    package org.learn;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.Display;
    public class thtest extends MIDlet
    Thread t;
    public void startApp()
    Alert a=new Alert("hello");
    a.setString("hello");
    Alert b=new Alert("world");
    b.setString("world");
    Display d = Display.getDisplay(this );
    d.setCurrent(a);
    t=Thread.currentThread();
    try{
    t.sleep(10000);
    catch (Exception e){}
    d.setCurrent(b);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    its just supposed to pause between the alerts using threads
    however when i run it using the wtk, the emulator run properly but when i launch the app, it stops executing giving me this:
    "Error verifying method org/learn/thtest startApp()V
    Approximate bytecode offset 49: Inconsistent or missing stackmap at target
    %the stack info%
    Execution completed.
    437782 bytecodes executed
    9 thread switches
    486 classes in the system (including system classes)
    2506 dynamic objects allocated (73832 bytes)
    2 garbage collections (60652 bytes collected)
    Execution completed.
    437782 bytecodes executed
    9 thread switches
    486 classes in the system (including system classes)
    ALERT: java/lang/VerifyError: org/learn/thtest.
    2506 dynamic objects allocated (73832 bytes)
    2 garbage collections (60652 bytes collected)
    please can someone help me out with this, is it an error on my part or do i have to set some option.

    Hi gandalf123,
    First, Thread.sleep is a static method, so you don't need to create a Thread object to use it.
    I think the problem is due to the fact you don't preverify your midlet.
    More over, you don't need to double post your question.

  • Problem with threads and camera.

    Hi everybody!
    I've a problem with taking snapshot.
    I would like to display a loading screen after it take snapshot ( sometimes i
    have to wait few seconds after i took snapshot. Propably photo is being taken in time where i have to wait).
    I was trying to use threads but i didn't succeed.
    I made this code:
    display.setCurrent(perform);               
            new Thread(new Runnable(){
                public void run() {               
                    while((!performing.isShown()) && (backgroundCamera.isShown())){
                        Thread.yield();
                    notifyAll();
            }).start();
            new Thread(new Runnable(){
                public void run() {
                    try {
                        this.wait();                   
                    } catch(Exception e) {
                        exceptionHandler(e);
                    photo = camera.snapshot();                               
                    display.setCurrent(displayPhoto);
            }).start();This code is sometimes showing performing screen but sometimes no.
    I don't know why. In my opinion performing.isShown() method isn't working correctly.
    Does anyone have some idea how to use threads here?

    Hi,
    I've finally managed to work this fine.
    The code:
           Object o = new Object();
           display.setCurrent(perform);               
            new Thread(new Runnable(){
                public void run() {               
                    while(!performing.isShown()){
                        Thread.yield();
                   synchronized(o) {
                      o.notify();
            }).start();
            new Thread(new Runnable(){
                public void run() {
                    try {
                        synchronized(o) {
                           o.wait(1);
                    } catch(Exception e) {
                        exceptionHandler(e);
                    photo = camera.snapshot();                               
                    display.setCurrent(displayPhoto);
            }).start();

  • Problem with threads and graphics

    I have a thread that chooses paths for a Travelling salesman problem, it then calls a TSPdraw class and passes it the path, which the class then draws. the problem is when i have two threads it creates two windows but only draws a path in one of them. any ideas where i`m going wrong

    Are you using swing components? Swing isn't threadsafe. If you have multiple threads that want to update your UI you need to use the SwingUtilities.invokeLater(...)or invokeAndWait(...). There is a page in the swing tutorial about this at: http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

  • Problem with threads hanging

    We have a problem where our application stops responding after a few days of usage. Things will for fine for a day or two, and then pretty quickly threads will start getting hung up, usually in places where they are allocating memory
    We are running WebLogic 8.1 SP2 on Sun JDK 1.4.2_04 on Solaris 8 using the alternate threading model and the -server hotspot vm. We are running pretty much the same code that we had no problems with under WebLogic 6.1 SP4 and Sun JDK 1.3.1.
    A thread dump usually shows that some or all of our execute threads are in the state "waiting for monitor entry" even though they are not currently waiting on any java locks. Here is a sample thread from the thread dump (we have ~120 threads so I don't want to post the full dump).
    =============================================================================================
    "ExecuteThread: '8' for queue: 'itgCrmWarExecutionQueue'" daemon prio=5 tid=0x005941d0 nid=0x2c waiting for monitor entry [c807f000..c807fc28]
    at java.lang.String.substring(String.java:1446)
    at java.lang.String.substring(String.java:1411)
    at weblogic.servlet.internal.ServletRequestImpl.getRelativeUri(ServletRequestImpl.java:1872)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3492)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    =============================================================================================
    String.java line 1446 for this jdk allocates a new String object, and all the other threads in this state also are creating new objects or arrays, etc.
    We've done a pstack on this process when it's in this state, and the threads that are in the "waiting for monitor entry" that look like they're allocating memory are all waiting on the same lwp_mutex_lock with some allocation method that's calling into the native TwoGenerationCollectorPolicy.mem_allocate_work (see pstack output below for the same thread as in the thread dump above)
    =============================================================================================
    ----------------- lwp# 44 / thread# 44 --------------------
    ff31f364 lwp_mutex_lock (e3d70)
    fee92384 __1cNObjectMonitorGenter26MpnGThread__v_ (5000, 525c, 5000, 50dc, 4800, 4af0) + 2d8
    fee324d4 __1cSObjectSynchronizerKfast_enter6FnGHandle_pnJBasicLock_pnGThread__v_ (c807f65c, c807f7d4, 5941d0, 0, 35d654, fee328ec) + 68
    fee32954 __1cQinstanceRefKlassZacquire_pending_list_lock6FpnJBasicLock__v_ (c807f7d4, ff170000, d4680000, 4491d4, fee1bc2c,
    0) + 78
    fee3167c __1cPVM_GC_OperationNdoit_prologue6M_i_ (c807f7bc, 4400, ff170000, 2d2b8, 4a6268, c807fa18) + 38
    fee2e0b0 __1cIVMThreadHexecute6FpnMVM_Operation__v_ (c807f7bc, 963a8, 0, 0, 1, 0) + 90
    fed2c2a4 __1cbCTwoGenerationCollectorPolicyRmem_allocate_work6MIii_pnIHeapWord__ (962c0, ff1c29ec, ff1c297c, ff131a26, 4800, 4998) + 160
    fed22940 __1cNinstanceKlassRallocate_instance6MpnGThread__pnPinstanceOopDesc__ (ee009020, 5941d0, 15ca581, 3647f0, 4a6268, c807f8c8) + 180
    fed34928 __1cLOptoRuntimeFnew_C6FpnMklassOopDesc_pnKJavaThread__v_ (ee009018, 5941d0, 0, 0, 0, 0) + 28
    fa435a58 ???????? (ee009018, e86de, 15ca4de, 50dc, 5941d0, c807f9c8)
    fb36f9a4 ???????? (0, d412ccd8, ee046c28, ff170000, 0, 0)
    fad8b278 ???????? (ee046c28, d6000c90, ee046530, 8, db8e8450, c807f9e8)
    fad62abc ???????? (d412ccd8, ee046530, d6000c90, ee3bfa38, 8, c807fa18)
    fa4b3c38 ???????? (c807fb9c, 0, f2134700, fa415e50, 8, c807faa8)
    fa40010c ???????? (c807fc28, c807fe90, a, ee9e1e20, 4, c807fb40)
    fed5d48c __1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHandle_pnRJavaCallArguments_pnGThread__v_ (c807fe88, c807fcf0, c807fda8, 5941d0, 5941d0, c807fd00) + 27c
    fee4b784 __1cJJavaCallsMcall_virtual6FpnJJavaValue_nLKlassHandle_nMsymbolHandle_4pnRJavaCallArguments_pnGThread__v_ (ff170000, 594778, c807fd9c, c807fd98, c807fda8, 5941d0) + 164
    fee5e8dc __1cJJavaCallsMcall_virtual6FpnJJavaValue_nGHandle_nLKlassHandle_nMsymbolHandle_5pnGThread__v_ (c807fe88, c807fe84, c807fe7c, c807fe74, c807fe6c, 5941d0) + 6c
    fee6fc74 __1cMthread_entry6FpnKJavaThread_pnGThread__v_ (5941d0, 5941d0, 838588, 594778, 306d10, fee69254) + 128
    fee6927c __1cKJavaThreadDrun6M_v_ (5941d0, 2c, 40, 0, 40, 0) + 284
    fee6575c _start   (5941d0, fa1a1600, 0, 0, 0, 0) + 134
    ff3758c0 lwpstart (0, 0, 0, 0, 0, 0)
    =============================================================================================
    Also when it's having this problem, the "VM Thread" is always using a lot of processor time. We did a couple of pstacks today while it was having this problem, and this thread was stuck in the ONMethodSweeper.sweep for over 15 minutes when we finally killed the server.
    From the thread dump:
    "VM Thread" prio=5 tid=0x000e2d20 nid=0x2 runnable
    From the first pstack:
    =============================================================================================
    ----------------- lwp# 2 / thread# 2 --------------------
    fed40c04 __1cXvirtual_call_RelocationIparse_ic6FrpnICodeBlob_rpC5rppnHoopDesc_pi_nNRelocIterator__ (42a2f4, fa5fa46d, ffffffff, fc4ffcb8, 42a2f4, 42a324) + 124
    fed46318 __1cKCompiledIC2t5B6MpnKRelocation__v_ (42a2f0, fc4ffd24, fc4ffd4c, e802, 0, 6) + 38
    fed90c38 __1cHnmethodVcleanup_inline_caches6M_v_ (fa5f7f88, fa608940, 1, 0, fa400000, 6) + 1ac
    fede18b4 __1cONMethodSweeperFsweep6F_v_ (2cf38, 0, ffffffff, ff1cf1fc, ff1c66e8, fede1d44) + 1b0
    fede1e6c __1cUSafepointSynchronizeFbegin6F_v_ (2cf38, ff1ba138, 5000, 50dc, 5000, 525c) + 248
    feef1fd4 __1cIVMThreadEloop6M_v_ (4400, 4000, 4324, 4000, 42b0, 3800) + 3d4
    feef1ae4 __1cIVMThreadDrun6M_v_ (e2d20, 2, 40, 0, 40, 0) + 8c
    fee6575c _start   (e2d20, ff270200, 0, 0, 0, 0) + 134
    ff3758c0 lwpstart (0, 0, 0, 0, 0, 0)
    =============================================================================================
    Second pstack
    =============================================================================================
    ----------------- lwp# 2 / thread# 2 --------------------
    fed41180 __1cXvirtual_call_RelocationIparse_ic6FrpnICodeBlob_rpC5rppnHoopDesc_pi_nNRelocIterator__ (0, ff1b9664, ffffffff, fc4ffcb8, a6f2cc, fc4ffbd0) + 6a0
    fed46318 __1cKCompiledIC2t5B6MpnKRelocation__v_ (a6f2c8, fc4ffd24, fc4ffd4c, e802, 0, 6) + 38
    fed90c38 __1cHnmethodVcleanup_inline_caches6M_v_ (faded4c8, fadf2c80, 1, 0, fa400000, 6) + 1ac
    fede18b4 __1cONMethodSweeperFsweep6F_v_ (2cf38, 0, ffffffff, ff1cf1fc, ff1c66e8, fede1d44) + 1b0
    fede1e6c __1cUSafepointSynchronizeFbegin6F_v_ (2cf38, ff1ba138, 5000, 50dc, 5000, 525c) + 248
    feef1fd4 __1cIVMThreadEloop6M_v_ (4400, 4000, 4324, 4000, 42b0, 3800) + 3d4
    feef1ae4 __1cIVMThreadDrun6M_v_ (e2d20, 2, 40, 0, 40, 0) + 8c
    fee6575c _start   (e2d20, ff270200, 0, 0, 0, 0) + 134
    ff3758c0 lwpstart (0, 0, 0, 0, 0, 0)
    =============================================================================================
    Has anyone ever seen anything like this? I'm trying to figure out if this is caused by something we're doing, or something relating to our environment and jvm options. Any ideas?

    Thanks for the reply - I'm testing our app with the +UseConcMarkSweepGC now in our test environment to make sure it doesn't cause any problems there.  Unfortunately the only place we've had this problem is on the production server, so it's extra difficult debugging this. 
    We're using the following memory options:
    -ms512m -mx512m -XX:NewSize=128m -XX:PermSize=192m -XX:MaxNewSize=128m -XX:MaxPermSize=192m -XX:SurvivorRatio=8and the following debugging options, as we've also been seeing OutOfMemoryErrors ( see http://forum.java.sun.com/thread.jsp?forum=37&thread=522354&tstart=45&trange=15 )
    -verbosegc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGCBTW, which c++filt version and options are you using? Our Solaris boxes only seem to have the GNU version installed. I was trying to run that on some of the other stack traces and wasn't getting anywhere, and didn't know if because it was GNU version wouldn't work on something compiled with the Sun compiler.
    Thanks!
    --Andy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem with threads and ProgressMonitor

    Dear Friends:
    I have a little problem with a thread and a ProgressMonitor. I have a long time process that runs in a thread (the thread is in an separate class). The thread has a ProgressMonitor that works fine and shows the tasks progress.
    But I need deactivate the main class(the main class is the user interface) until the thread ends.
    I use something like this:
    LongTask myTask=new LongTask();
    myTask.start();
    myTask.join();
    Now, the main class waits for the task to end, but the progress monitor don`t works fine: it shows only the dialog but not the progress bar.
    What's wrong?

    Is the dialog a modal dialog? This can block other UI updates.
    In general, you should make sure that it isn't modal, and that your workThread has a fairly low priority so that the UI can do its updating

Maybe you are looking for

  • Wireless router for iMac, MacBook Pro and iBook G4

    I am in a deep trouble finding a wireless router which could be configured by a Mac and working with iMac, MacBook Pro and iBook G4. Please recommend me a wireless router

  • ITunes says i need to authorize, but i already did!

    So i recently got an iphone 4s, but I used to have an ipod touch. I got all my apps to transfer from the ipod to my iTunes library on my computer, but now I can't get SOME of them to transfer from the library to my new iphone. For example, when i try

  • Preview not saving check boxes in PDF forms

    For some reason 10.6's preview will not save check boxes in PDF forms, you can click them but as soon as you save them they disappear.

  • Problems adding nodes to JTree on runtime

    I have added a popup menu to my tree, and would like to be able to add new nodes by right clicking, so I have this code in my event listener: void newFolderFolderPopup_mousePressed(MouseEvent e) {   System.out.println("WEEEEEEEEEEEEEEEEEEEEEEEE");  

  • Upgraded to new software, Now I have 39gig worth on my itunes, not 8gig

    I deleted my old itunes software and quicktime and installed the new stuff. Now it is saying I have 39 gigs of music with the same amount of songs(1900). I actually only have 8 gigs of music. Anyway to fix this. I have a 30gig ipod. thanks Wes