Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
cloudooo
Commits
5102981a
Commit
5102981a
authored
May 16, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix deadlock in uno thread
parent
8f3d6526
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
18 deletions
+30
-18
cloudooo/handler/ooo/handler.py
cloudooo/handler/ooo/handler.py
+4
-1
cloudooo/handler/ooo/helper/helper_util.py
cloudooo/handler/ooo/helper/helper_util.py
+11
-0
cloudooo/handler/ooo/helper/openoffice_tester.py
cloudooo/handler/ooo/helper/openoffice_tester.py
+1
-1
cloudooo/handler/ooo/helper/unoconverter.py
cloudooo/handler/ooo/helper/unoconverter.py
+1
-2
cloudooo/handler/ooo/helper/unomimemapper.py
cloudooo/handler/ooo/helper/unomimemapper.py
+1
-1
cloudooo/handler/ooo/mimemapper.py
cloudooo/handler/ooo/mimemapper.py
+0
-1
cloudooo/handler/ooo/tests/testOooUnoConverter.py
cloudooo/handler/ooo/tests/testOooUnoConverter.py
+3
-3
cloudooo/handler/ooo/tests/testOooUnoMimemapper.py
cloudooo/handler/ooo/tests/testOooUnoMimemapper.py
+9
-9
No files found.
cloudooo/handler/ooo/handler.py
View file @
5102981a
...
@@ -126,11 +126,14 @@ class Handler(object):
...
@@ -126,11 +126,14 @@ class Handler(object):
if
pid_exists
(
process
.
pid
):
if
pid_exists
(
process
.
pid
):
logger
.
debug
(
"Process %s terminated"
,
process
.
pid
)
logger
.
debug
(
"Process %s terminated"
,
process
.
pid
)
process
.
terminate
()
process
.
terminate
()
if
(
process
.
returncode
<
0
and
process
.
returncode
!=
-
6
)
or
stderr
:
if
(
process
.
returncode
!=
-
3
)
or
stderr
:
logger
.
error
(
"Process %s command:%s"
,
process
.
pid
,
" "
.
join
(
command_list
))
logger
.
error
(
"Process %s command:%s"
,
process
.
pid
,
" "
.
join
(
command_list
))
logger
.
error
(
"Process %s stdout:%s"
,
process
.
pid
,
stdout
)
logger
.
error
(
"Process %s stdout:%s"
,
process
.
pid
,
stdout
)
logger
.
error
(
"Process %s stderr:%s"
,
process
.
pid
,
stderr
)
logger
.
error
(
"Process %s stderr:%s"
,
process
.
pid
,
stderr
)
logger
.
debug
(
"Process %s terminated with returncode %s"
,
process
.
pid
,
process
.
returncode
)
logger
.
debug
(
"Process %s terminated with returncode %s"
,
process
.
pid
,
process
.
returncode
)
if
process
.
returncode
!=
-
3
:
raise
ValueError
(
"unocnverter.py should always be interrupted by external signal,"
" otherwise deadlock can be raised"
)
return
stdout
,
stderr
return
stdout
,
stderr
def
_callUnoConverter
(
self
,
*
feature_list
,
**
kw
):
def
_callUnoConverter
(
self
,
*
feature_list
,
**
kw
):
...
...
cloudooo/handler/ooo/helper/helper_util.py
View file @
5102981a
import
signal
import
sys
import
sys
import
os
import
os
import
time
import
time
...
@@ -31,3 +32,13 @@ def getServiceManager(host, port, uno_path, office_binary_path):
...
@@ -31,3 +32,13 @@ def getServiceManager(host, port, uno_path, office_binary_path):
time
.
sleep
(
1
)
time
.
sleep
(
1
)
# Get the ServiceManager object
# Get the ServiceManager object
return
uno_connection
.
ServiceManager
return
uno_connection
.
ServiceManager
def
exitOverAbort
(
main_func
):
try
:
main_func
()
except
:
import
traceback
sys
.
stderr
.
write
(
traceback
.
format_exc
())
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
os
.
kill
(
os
.
getpid
(),
signal
.
SIGQUIT
)
\ No newline at end of file
cloudooo/handler/ooo/helper/openoffice_tester.py
View file @
5102981a
...
@@ -37,4 +37,4 @@ def main():
...
@@ -37,4 +37,4 @@ def main():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
(
)
helper_util
.
exitOverAbort
(
main
)
\ No newline at end of file
cloudooo/handler/ooo/helper/unoconverter.py
View file @
5102981a
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#
#
##############################################################################
##############################################################################
import
os
import
sys
import
sys
import
csv
import
csv
import
codecs
import
codecs
...
@@ -367,4 +366,4 @@ def main():
...
@@ -367,4 +366,4 @@ def main():
sys
.
stdout
.
write
(
output
)
sys
.
stdout
.
write
(
output
)
if
"__main__"
==
__name__
:
if
"__main__"
==
__name__
:
main
(
)
helper_util
.
exitOverAbort
(
main
)
\ No newline at end of file
cloudooo/handler/ooo/helper/unomimemapper.py
View file @
5102981a
...
@@ -141,4 +141,4 @@ def main():
...
@@ -141,4 +141,4 @@ def main():
sort_keys
=
True
,
indent
=
2
,
separators
=
(
','
,
':'
)))
sort_keys
=
True
,
indent
=
2
,
separators
=
(
','
,
':'
)))
if
"__main__"
==
__name__
:
if
"__main__"
==
__name__
:
main
(
)
helper_util
.
exitOverAbort
(
main
)
\ No newline at end of file
cloudooo/handler/ooo/mimemapper.py
View file @
5102981a
...
@@ -129,7 +129,6 @@ class MimeMapper(object):
...
@@ -129,7 +129,6 @@ class MimeMapper(object):
stdout
,
stderr
=
process
.
communicate
()
stdout
,
stderr
=
process
.
communicate
()
if
stderr
:
if
stderr
:
logger
.
error
(
stderr
)
logger
.
error
(
stderr
)
if
process
.
returncode
:
raise
ValueError
(
stdout
)
raise
ValueError
(
stdout
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
...
...
cloudooo/handler/ooo/tests/testOooUnoConverter.py
View file @
5102981a
...
@@ -75,9 +75,9 @@ class TestUnoConverter(HandlerTestCase):
...
@@ -75,9 +75,9 @@ class TestUnoConverter(HandlerTestCase):
"--destination_format=%s"
%
"doc"
,
"--destination_format=%s"
%
"doc"
,
"--source_format=%s"
%
"odt"
,
"--source_format=%s"
%
"odt"
,
"--mimemapper=%s"
%
mimemapper_pickled
]
"--mimemapper=%s"
%
mimemapper_pickled
]
stdout
,
stderr
=
Popen
(
command
,
process
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
=
PIPE
,
stdout
,
stderr
=
process
.
communicate
()
stderr
=
PIPE
).
communicate
(
)
self
.
assertEquals
(
process
.
returncode
,
-
3
)
self
.
assertEquals
(
stderr
,
''
)
self
.
assertEquals
(
stderr
,
''
)
output_url
=
stdout
.
replace
(
'
\
n
'
,
''
)
output_url
=
stdout
.
replace
(
'
\
n
'
,
''
)
self
.
assertTrue
(
exists
(
output_url
),
stdout
)
self
.
assertTrue
(
exists
(
output_url
),
stdout
)
...
...
cloudooo/handler/ooo/tests/testOooUnoMimemapper.py
View file @
5102981a
...
@@ -63,9 +63,9 @@ class TestUnoMimeMapper(HandlerTestCase):
...
@@ -63,9 +63,9 @@ class TestUnoMimeMapper(HandlerTestCase):
"--office_binary_path=%s"
%
self
.
office_binary_path
,
"--office_binary_path=%s"
%
self
.
office_binary_path
,
"--hostname=%s"
%
self
.
hostname
,
"--hostname=%s"
%
self
.
hostname
,
"--port=%s"
%
self
.
openoffice_port
]
"--port=%s"
%
self
.
openoffice_port
]
stdout
,
stderr
=
Popen
(
command
,
process
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
=
PIPE
,
stdout
,
stderr
=
process
.
communicate
()
stderr
=
PIPE
).
communicate
(
)
self
.
assertEquals
(
process
.
returncode
,
-
15
)
self
.
assertEquals
(
stderr
,
''
)
self
.
assertEquals
(
stderr
,
''
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
self
.
assertTrue
(
'filter_dict'
in
locals
())
self
.
assertTrue
(
'filter_dict'
in
locals
())
...
@@ -84,9 +84,9 @@ class TestUnoMimeMapper(HandlerTestCase):
...
@@ -84,9 +84,9 @@ class TestUnoMimeMapper(HandlerTestCase):
"/helper/unomimemapper.py"
),
"/helper/unomimemapper.py"
),
"--hostname=%s"
%
self
.
hostname
,
"--hostname=%s"
%
self
.
hostname
,
"--port=%s"
%
self
.
openoffice_port
]
"--port=%s"
%
self
.
openoffice_port
]
stdout
,
stderr
=
Popen
(
command
,
process
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
=
PIPE
,
stdout
,
stderr
=
process
.
communicate
()
stderr
=
PIPE
).
communicate
(
)
self
.
assertEquals
(
process
.
returncode
,
-
3
)
self
.
assertEquals
(
stderr
,
''
)
self
.
assertEquals
(
stderr
,
''
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
self
.
assertTrue
(
'filter_dict'
in
locals
())
self
.
assertTrue
(
'filter_dict'
in
locals
())
...
@@ -110,9 +110,9 @@ class TestUnoMimeMapper(HandlerTestCase):
...
@@ -110,9 +110,9 @@ class TestUnoMimeMapper(HandlerTestCase):
"--office_binary_path=%s"
%
self
.
office_binary_path
,
"--office_binary_path=%s"
%
self
.
office_binary_path
,
"--hostname=%s"
%
self
.
hostname
,
"--hostname=%s"
%
self
.
hostname
,
"--port=%s"
%
self
.
openoffice_port
]
"--port=%s"
%
self
.
openoffice_port
]
stdout
,
stderr
=
Popen
(
command
,
process
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
=
PIPE
,
stdout
,
stderr
=
process
.
communicate
()
stderr
=
PIPE
).
communicate
(
)
self
.
assertEquals
(
process
.
returncode
,
-
3
)
self
.
assertEquals
(
stdout
,
''
)
self
.
assertEquals
(
stdout
,
''
)
self
.
assertTrue
(
stderr
.
endswith
(
error_msg
),
stderr
)
self
.
assertTrue
(
stderr
.
endswith
(
error_msg
),
stderr
)
openoffice
.
start
()
openoffice
.
start
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment