shoenig / go-mqtt

A development fork of the Eclipse Paho Go MQTT client
http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.golang.git/
Eclipse Public License 1.0
13 stars 6 forks source link

Windows filesystem trips over itself #11

Closed shoenig closed 10 years ago

shoenig commented 10 years ago

Apparently Windows implements goroutines as processes, which causes big problems when using filestore.go

panic: remove /tmp/fvt_client_test/s/1.msg: The process cannot access the file because it is being used by another process.

shoenig commented 10 years ago

Actually it's worse than that.

Test_FileStore_del shows the same error, but it does not create any goroutines. It creates a unique filestore at /tmp/teststore/_del , it puts a message, and then it deletes that message. The client crashes on the delete.

I'm short on ideas how to work around this.

=== RUN Test_FileStore_del
[store]      store is opened at /tmp/teststore/_del
[store]      writing message at: /tmp/teststore/_del/17.msg
--- FAIL: Test_FileStore_del (0.00 seconds)
panic: remove /tmp/teststore/_del/17.msg: The process cannot access the file because it is being used by another process. [recovered]
        panic: remove /tmp/teststore/_del/17.msg: The process cannot access the file because it is being used by another process.

goroutine 7 [running]:
testing.func·004()
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist675583351/go/src/pkg/testing/testing.go:348 +0xd0
github.com/shoenig/go-mqtt.chkerr(0xc080096240, 0xc080096930)
        C:/cygwin/home/sahoenig/GO/src/github.com/shoenig/go-mqtt/oops.go:10 +0x50
github.com/shoenig/go-mqtt.(*filestore).del(0xc0800a3200, 0x11)
        C:/cygwin/home/sahoenig/GO/src/github.com/shoenig/go-mqtt/store.go:91 +0xb2
github.com/shoenig/go-mqtt.Test_FileStore_del(0xc080093240)
        C:/cygwin/home/sahoenig/GO/src/github.com/shoenig/go-mqtt/fvt_store_test.go:190 +0x1eb
testing.tRunner(0xc080093240, 0x759080)
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist675583351/go/src/pkg/testing/testing.go:353 +0x8d
created by testing.RunTests
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist675583351/go/src/pkg/testing/testing.go:433 +0x86e

goroutine 1 [chan receive]:
testing.RunTests(0x663e28, 0x758f60, 0x59, 0x59, 0x1, ...)
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist675583351/go/src/pkg/testing/testing.go:434 +0x891
testing.Main(0x663e28, 0x758f60, 0x59, 0x59, 0x7518d0, ...)
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist675583351/go/src/pkg/testing/testing.go:365 +0x8d
main.main()
        C:/cygwin/tmp/go-build461006607/github.com/shoenig/go-mqtt/_test/_testmain.go:221 +0x9d
exit status 2
FAIL    github.com/shoenig/go-mqtt      0.731s
shoenig commented 10 years ago

fixed by closing files in 74b99c4