andriyko / sublime-robot-framework-assistant

Robot Framework plugin for Sublime Text3
MIT License
110 stars 43 forks source link

Sometimes `Robot Framework: Create Database` fails #100

Closed aaltat closed 8 years ago

aaltat commented 8 years ago

Sometimes Robot Framework: Create Database fails and the following error is seen in the log file:

INFO:2016-04-27 18:32:24,714: Creating table for: BuiltIn
Traceback (most recent call last):
File "", line 1, in 
File "C:\Python27\lib\multiprocessing__init__.py", line 84, in 
import multiprocessing
ImportError: DLL load failed: %1 is not a valid Win32 application.
Traceback (most recent call last):
File "", line 1, in 
File "C:\Python27\lib\multiprocessing__init_.py", line 84, in 
import _multiprocessing
georgecarstoiu commented 8 years ago

By having the db being created automatically, this issue is not as prevalent, but it still does happen when creating the db for the first time.

georgecarstoiu commented 8 years ago

This bug should really be marked as a blocker - it can really make it impossible sometimes to create and integrate new testcases.

aaltat commented 8 years ago

I can not reproduce this bug. @georgecarstoiu have you found a reliable manner to reproduce the bug?

aaltat commented 8 years ago

It could be that Sublime Text 3 build 3114 did contain a fix for this: Fixed a scenario where changes to .tmPreferences files weren't being picked up or the API: Changes to how plugins are loaded. This should be transparent, but resolves a number of corner cases. Because I can not anymore reproduce the problem in anyway perhaps it does not anymore exist.

georgecarstoiu commented 8 years ago

I am using the latest build of SB3 3114 from the 12th of May and I am getting the error 85% of the times. This is when running on Win7 x64.

The strange thing is that I have the exact same configuration running on a Win8 x64 machine, and everything seems to be working fine there. I never had one error.

Could this be OS based? Can it be fixed without having to install Win8?

aaltat commented 8 years ago

I run Windows 7 (x64) and I have not seen the error since the build 3114 came. Yesterday I did try to repeat the bug for a long time and was not able to repeat the bug.

I have feeling that this could be some sort of caching issue, somewhere. But because it happens for you so often, could you change the scan_and_index.py line 28 from:

    return arg_list

to

    print(arg_list)
    return arg_list

It will print the arguments which it did get from the configuration files, to the Sublime console, which the plugin uses to start launch the indexing process. Could you send me the output?

georgecarstoiu commented 8 years ago

Modified the scan_and_index.py as per your instructions, but the problem is that whenever I execute the 'Create db' command, SB3 freezes and I cannot see the output in the console.

Is there a log somewhere that logs the output of the console even if SB3 freezes?

aaltat commented 8 years ago

That does not go to the log file, but lets do it in other way. First remove the previous modifications. Then in same file, after the line 48 add new line:

    print(index_popen_arg_parser())

It should look like this:

class ScanIndexCommand(sublime_plugin.TextCommand):

    def run(self, edit):
        print(index_popen_arg_parser())
        log_file = get_setting(SettingObject.log_file)
georgecarstoiu commented 8 years ago

Modified and this is what the console is showing every time I start SB3. Can't run the 'Create db' as it is greyed out.

Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 78, in reload_plugin m = importlib.import_module(modulename) File "./python3.3/importlib/init.py", line 90, in import_module File "", line 1584, in _gcd_import File "", line 1565, in _find_and_load File "", line 1532, in _find_and_load_unlocked File "", line 584, in _check_name_wrapper File "", line 1022, in load_module File "", line 1003, in load_module File "", line 560, in module_for_loader_wrapper File "", line 868, in _load_module File "", line 313, in _call_with_frames_removed File "C:\Users\george.carstoiu\AppData\Roaming\Sublime Text 3\Packages\Robot Framework Assistant\Robot.py", line 7, in from .commands import * File "C:\Users\george.carstoiu\AppData\Roaming\Sublime Text 3\Packages\Robot Framework Assistant\commandsinit.py", line 1, in from .scan_and_index import ScanIndexCommand File "C:\Users\george.carstoiu\AppData\Roaming\Sublime Text 3\Packages\Robot Framework Assistant\commands\scan_and_index.py", line 49 print(index_popen_arg_parser()) ^ TabError: inconsistent use of tabs and spaces in indentation plugins loaded Package Control: Skipping automatic upgrade, last run at 2016-06-03 09:41:46, next run at 2016-06-03 10:41:46 or after

aaltat commented 8 years ago

Python is space sensitive language. There should be 8 spaces before the print(index_popen_arg_parser()) text and tabs are not allowed. It must align with the log_file = get_setting(SettingObject.log_file) line correctly.

georgecarstoiu commented 8 years ago

My bad :) - modified the file again and this is what I got when trying to run the Create db command:

Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 574, in run return self.run(edit) File "C:\Users\george.carstoiu\AppData\Roaming\Sublime Text 3\Packages\Robot Framework Assistant\commands\scan_and_index.py", line 49, in run print(index_popen_arg_parser()) TypeError: index_popen_arg_parser() missing 1 required positional argument: 'mode'

I guess I am still missing something?

aaltat commented 8 years ago

My bad this time, should have write: print(index_popen_arg_parser("all"))

georgecarstoiu commented 8 years ago

Again, once I start the Create db command, ST3 freezes and I cannot see any output in the console.

aaltat commented 8 years ago

Hmmm, really strange. That function only gets the configurations and only print was added. I need to think about it, but it will take time.

georgecarstoiu commented 8 years ago

Take your time. I will try to make a fresh install of everything later on as well when I have some time and get back to you if the problem persists.

aaltat commented 8 years ago

There is other way to print the parameters. Again, first undo all the other changes. Then open the run_index.py file. Then add line, after line 68 and print the args. If you have installed Robot Framework with Python 2 the print looks like this:

    args = c_parser.parse_args()
    print args
    module_search_path = []

Or if you are using Python 3 with Robot Framework, then it looks like this:

    args = c_parser.parse_args()
    print(args)
    module_search_path = []

This time the output goes to a log file. The log file can be found from the plugin installation directory: Packages\Robot Framework Assistant\database\scan_index.log and when plugin works normally if contains something like this:

Namespace(db_path='C:\\Users\\UserName\\AppData\\Roaming\\Sublime Text 3\\Packages\\Robot Framework Assistant\\database\\scanner', db_table=None, index_path='C:\\Users\\UserName\\AppData\\Roaming\\Sublime Text 3\\Packages\\Robot Framework Assistant\\database\\index', mode='all', module_search_path=['D:\\workspace\\robotframework-from-sublime\\test\\resource\\test_data\\suite_tree', 'D:\\workspace\\sublime-robot-framework-assistant\\test\\resource\\test_data\\real_suite'], path_to_lib_in_xml='D:\\workspace\\robotframework-from-sublime\\test\\resource\\library')

Check the log file output against the settings you have defined and tell if there are any differences. Also send the line containing Namespace(... for me to look too.

georgecarstoiu commented 8 years ago

Uninstalled everything and started from scratch. It took a bit to configure everything but good that now it works.

Will keep an eye on this issue and will let you know if I run into it again. Until then I think we should close this ticket.

Thanks for the support and the effort! :)

aaltat commented 8 years ago

Let's keep the issue open for some time and if I don't see the problem or hear from someone that problem still exists I will then close the issue.

Happy testing and have a nice weekend.

aaltat commented 8 years ago

I assume that this is not anymore problem and bug and be safely closed. If it is a problem, let me know and I will reopen the issue.

georgecarstoiu commented 8 years ago

Have been using it without any problems now for almost 2 weeks. No issues whatsoever.

aaltat commented 8 years ago

Ok good to know