File access with mongrel running as windows service

i have an archive of documents (word, excel, jpeg, png, gif…)
residing on a network share that is accessed via send_file.

when running mongrel on the command line the files are properly
delivered.
with mongrel running as a service they don’t.

now normally i would think that should be fixable by configuring the
service to run under a user that can read the files…

but i’ve already tried that without success.

running the service as system or administrator or the user i’m using
for development (the same user i run the mongrel on command line) does
NOT help. so i can’t figure out how to get this to work.

development or production mode also doesn’t make a difference.

from what i’ve seen so far this generally applies to any File IO access.

could this be a bug in the mongrel service implementation?

On Nov 7, 2007 3:01 PM, gmail [email protected] wrote:

i have an archive of documents (word, excel, jpeg, png, gif…)
residing on a network share that is accessed via send_file.

when running mongrel on the command line the files are properly
delivered.
with mongrel running as a service they don’t.

Try running “net use” inside the process to see if the network share is
mounted at all. This sounds like the typical Windows/web problem where
the
operator assumes that everybody sees the same shares that she sees in
her
session. In reality, network shares are mounted per login session. Two
users can be logged in on the the same Windows server and have different
shares available on Z:, which is clever, but also sort of confusing.
What
is even more confusing is that you may be logged on as “user1” and have
something mapped to Z:, but the service running as user1 has nothing on
Z: –
it needs to create its own mappings.

Let us know if this helps.

/David

yes that helped!

i just needed to switch the drive letter with the UNC path :slight_smile:

thanks for pointing that out.
years of using windows but never thought it worked that way

Am 07.11.2007 um 15:48 schrieb David V.:

sorry that wasn’t posted “anonymously” on purpose.
i just set up my gmail account with imap in apple mail last night and
didn’t even noticed it put gmail in the sender name. until i sent the
reply.

Am 07.11.2007 um 15:48 schrieb David V.:

yes that helped!

i just needed to switch the drive letter with the UNC path :slight_smile:

thanks for pointing that out.
years of using windows but never thought it worked that way

Am 07.11.2007 um 15:48 schrieb David V.:

David V. wrote:

On Nov 7, 2007 3:01 PM, gmail [email protected] wrote:

i have an archive of documents (word, excel, jpeg, png, gif…)
residing on a network share that is accessed via send_file.

when running mongrel on the command line the files are properly
delivered.
with mongrel running as a service they don’t.

Try running “net use” inside the process to see if the network share is
mounted at all. This sounds like the typical Windows/web problem where
the
operator assumes that everybody sees the same shares that she sees in
her
session. In reality, network shares are mounted per login session. Two
users can be logged in on the the same Windows server and have different
shares available on Z:, which is clever, but also sort of confusing.
What
is even more confusing is that you may be logged on as “user1” and have
something mapped to Z:, but the service running as user1 has nothing on
Z: –
it needs to create its own mappings.

Let us know if this helps.

/David

David could you explain it more i think i have same sort of problem
what i am doing is.
i created a web application using instant rails,i having rails
2.2.2,mysql database,mongrel running as a server,
i used mysql database to store the different property of files and i am
plcing actual file(phsical file) on samba server.now i run my it as
application ,everthing is fine but soon i run my application as windows
service i am getting this problem

No such file or directory - Z:/streams/Texture.bmp
Z: is drive letter
here i am trying to upload Texture.bmp file to samba means to Z:/streams
any help …

Luis L. wrote:

On Tue, Aug 17, 2010 at 10:54 AM, Amit T. [email protected]
wrote:

No such file or directory - Z:/streams/Texture.bmp
Z: is drive letter
here i am trying to upload Texture.bmp file to samba means to Z:/streams
any help …

Unless you’re running the mongrel service as the same user, the mapped
network drives are not available.

Either you use the full network path (\SERVER\PATH) or you run the
service as the user that defines the mapped network drives.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupé²¹

Luis
i tried to set full network path
but not successed and how do i run the service under the user that
defines the mapped network drives.

On Tue, Aug 17, 2010 at 11:08 AM, Amit T. [email protected]
wrote:

Luis
i tried to set full network path
but not successed and how do i run the service under the user that
defines the mapped network drives.

You will need to access the Services definition and under properties
select Run as user. You will need to provide the password too. (all
this under administrative tools, things may vary between windows
versions).


Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Luis L. wrote:

On Tue, Aug 17, 2010 at 11:08 AM, Amit T. [email protected]
wrote:

Luis
i tried to set full network path
but not successed and how do i run the service under the user that
defines the mapped network drives.

You will need to access the Services definition and under properties
select Run as user. You will need to provide the password too. (all
this under administrative tools, things may vary between windows
versions).


Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupé²¹

r u saying i ahve to run my service under netwrok service and i would
like to konw how i run my service under netwrok service??

On Tue, Aug 17, 2010 at 10:54 AM, Amit T. [email protected]
wrote:

No such file or directory - Z:/streams/Texture.bmp
Z: is drive letter
here i am trying to upload Texture.bmp file to samba means to Z:/streams
any help …

Unless you’re running the mongrel service as the same user, the mapped
network drives are not available.

Either you use the full network path (\SERVER\PATH) or you run the
service as the user that defines the mapped network drives.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

On Tue, Aug 17, 2010 at 12:08 PM, Amit T. [email protected]
wrote:

r u saying i ahve to run my service under netwrok service and i would
like to konw how i run my service under netwrok service??

No, I’m saying that you need to run your service under a user account
that defines those mapped network drives. Since network mappings (Z:,
W:, etc) are dependent of the user, needs to be run as that particular
user.

You need to change those settings for that particular service under
the “Services” manager in Administrative Tools (control panel).


Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Luis L. wrote:

On Tue, Aug 17, 2010 at 12:08 PM, Amit T. [email protected]
wrote:

r u saying i ahve to run my service under netwrok service and i would
like ?to konw how i run my service under netwrok service??

No, I’m saying that you need to run your service under a user account
that defines those mapped network drives. Since network mappings (Z:,
W:, etc) are dependent of the user, needs to be run as that particular
user.

You need to change those settings for that particular service under
the “Services” manager in Administrative Tools (control panel).


Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupé²¹

LUIS
i am not getting error like
Permission denied - //Z/:streams/al00_96000.aac
what should i do and i am also running service as a particular user

On Wed, Aug 18, 2010 at 9:47 AM, Amit T. [email protected]
wrote:

LUIS
i am not getting error like
Permission denied - //Z/:streams/al00_96000.aac
what should i do and i am also running service as a particular user

I’m having problems understanding your english.

Mapped network drives do not start with //, they are normal network
letters:

C:\Users\Luis>net view
Server Name Remark


\KEORE

C:\Users\Luis>net view \KEORE
Shared resources at \KEORE

Share name Type Used as Comment

Users Disk

C:\Users\Luis>net use * \KEORE\Users
Drive Z: is now connected to \KEORE\Users.

The command completed successfully.

C:\Users\Luis>irb
irb(main):001:0> require ‘fileutils’
=> true
irb(main):002:0> FileUtils.touch “Z://foo.txt”
Errno::EACCES: Permission denied - Z://foo.txt
from
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1034:in
initialize' from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1034:in open’
from
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1034:in
touch' from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1028:in each’
from
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1028:in
`touch’
from (irb):2

It is clear I don’t have permission to do that, but:

irb(main):003:0> FileUtils.touch “Z://Luis/foo.txt”
=> [“Z://Luis/foo.txt”]

I do.

Also:

irb(main):004:0> FileUtils.touch “//Z://Luis/bar.txt”
Errno::ENOENT: No such file or directory - //Z://Luis/bar.txt
from
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1034:in
initialize' from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1034:in open’
from
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1034:in
touch' from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1028:in each’
from
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p302-i386-mingw32/lib/ruby/1.8/fileutils.rb:1028:in
`touch’
from (irb):4

it is clear that // should not prepend the drive letter, but instead:

irb(main):005:0> FileUtils.touch “//KEORE/Users/Luis/bar.txt”
=> [“//KEORE/Users/Luis/bar.txt”]

I hope this explains a bit better what I’m talking about.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Luis I tried to upload a file of size 324mb but something strange
happened
i’m able to upload the file but still i’m getting error
Invalid argument -
//192.122.227.53/Smar/streams2/D1_monsters_3_720x480_422i_SP_5Mbps_30fps_657frames.yuv
but when i checked the location(//192.122.227.53/Smar/streams2) file was
there
what could be the reason ??

Thanks my friend…
i am able to figure out my problem …

Luis L. wrote:

On Fri, Aug 20, 2010 at 10:31 AM, Amit T. [email protected]
wrote:

Luis I tried to upload a file of size 324mb but something strange
happened
i’m able to upload the file but still i’m getting error
?Invalid argument -
//192.122.227.53/Smar/streams2/D1_monsters_3_720x480_422i_SP_5Mbps_30fps_657frames.yuv
but when i checked the location(//192.122.227.53/Smar/streams2) file was
there
what could be the reason ??

I have no idea where are you receiving the ‘invalid argument’ error.

It is extrematelly important than when you report an error, provide
enough details and precision about it, more precisely, the full error
messages and backtraces.

We can’t replicate or provide you help if you skim it and provide
vague information.

Help us help you.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupé²¹

i don’t know how to ask this question because am new to
rails.
but i want to know to is which part of code sumit_tag will take you
means
after execution of sumit_tag where control of programme goes??

On Fri, Aug 20, 2010 at 10:31 AM, Amit T. [email protected]
wrote:

Luis I tried to upload a file of size 324mb but something strange
happened
i’m able to upload the file but still i’m getting error
Invalid argument -
//192.122.227.53/Smar/streams2/D1_monsters_3_720x480_422i_SP_5Mbps_30fps_657frames.yuv
but when i checked the location(//192.122.227.53/Smar/streams2) file was
there
what could be the reason ??

I have no idea where are you receiving the ‘invalid argument’ error.

It is extrematelly important than when you report an error, provide
enough details and precision about it, more precisely, the full error
messages and backtraces.

We can’t replicate or provide you help if you skim it and provide
vague information.

Help us help you.

Luis L.
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry