fsharp / zarchive-vim-fsharp

F# bindings for vim
MIT License
143 stars 34 forks source link

Avoid race condition in get_path on some systems #36

Closed puffybsd closed 8 years ago

puffybsd commented 8 years ago

On some systems, the plugin fails to initialize due to a 'TypeError'. TypeError: argument of type 'NoneType' is not iterable. The embedded python code initializes G.paths to an empty map; however, if a key is not found in the map, the code re-initializes G.paths using G.fsac.get_paths(). On some systems, the first call to get_paths() returns 'None'. Checking 'None' for the key raises the error. Adding a call to G.fsac.get_paths() when fsac is initialized avoids the race condition. This change does not fix the underlying race condition, but has been tested on both a system that exhibits the behavior and one that does not. Both test systems running the same version of vim, python, mono, vim-fsharp and with the same .vimrc on arch Linux. The only noticeable difference between the two test systems is kernel version and cpu (4.4.0/intel on working system, 4.2.5/amd on error system).

Fixes #33

kjnilsson commented 8 years ago

great stuff - thank you!

leafgarland commented 8 years ago

Yes, thanks for this. Much more reliable now.