Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Panic on Mac OS X when debugging #212

Copy link
Copy link

Description

@NightBlaze
Issue body actions

Before reporting an issue, please ensure you are using the latest release of fsnotify.

Which operating system (GOOS) and version are you using?

OS:
ProductName: Mac OS X
ProductVersion: 10.12.5
BuildVersion: 16F73

Go:
go version go1.8.3 darwin/amd64

Delve:
Delve Debugger
Version: 1.0.0-rc.1
Build:

IDE:
Visual Studio Code
Ver 1.14.1 (1.14.1)
2648980a697a4c8fb5777dcfb2ab110cec8a2f58
2017-07-13T19:05:02.227Z

Please describe the issue that occurred.

When execution continues after stop at breakpoint then panic raised at kqueue.go -> read(kq int, events []unix.Kevent_t, timeout *unix.Timespec)

Are you able to reproduce the issue? Please provide steps to reproduce and a code sample if possible.

  1. I use sample code from https://github.com/fsnotify/fsnotify/blob/master/example_test.go
  2. Set up breakpoint at any place
  3. Trigger breakpoint
  4. When step over or continue execution then panic raised
panic: runtime error: slice bounds out of range

goroutine 8 [running]:
bitbucket.org/project/vendor/github.com/fsnotify/fsnotify.read(0x8, 0xc4202e0e88, 0xa, 0xa, 0x1708c50, 0xc4202e0e88, 0x0, 0xa, 0x0, 0x0)

/path_to_project/vendor/github.com/fsnotify/fsnotify/kqueue.go:498 +0x2fe
bitbucket.org/litkiosk/litkiosk_server/vendor/github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc42001c360)

/path_to_project/vendor/github.com/fsnotify/fsnotify/kqueue.go:284 +0xda
created by bitbucket.org/litkiosk/litkiosk_server/vendor/github.com/fsnotify/fsnotify.NewWatcher

/path_to_project/vendor/github.com/fsnotify/fsnotify/kqueue.go:62 +0x2c8

I added log in this function

func read(kq int, events []unix.Kevent_t, timeout *unix.Timespec) ([]unix.Kevent_t, error) {
	n, err := unix.Kevent(kq, nil, events, timeout)
	if err != nil {
		return nil, err
	}
	fmt.Println("n", n, "len", len(events), "cap", cap(events))
	return events[0:n], nil
}

and it prints

n 0 len 10 cap 10
n 0 len 10 cap 10
n 0 len 10 cap 10
n 0 len 10 cap 10
2017/07/15 12:00:40 debugger.go:505: continuing
n 33554795 len 10 cap 10
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.