prabhu2289 / roundhouse

Automatically exported from code.google.com/p/roundhouse
0 stars 0 forks source link

PostgreSQL Always Errors Out? #75

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run RoundhousE against PostgreSQL.
2. Observe that the execution ends with the following
Cannot access a disposed object.
Object name: 'NpgsqlConnection'.
3. Observe that the exit code is 1.

What is the expected output? What do you see instead?

I expect it to exit without an error. Everything seems to actually work. The 
database is created automatically, the scripts are run correctly, and the 
database can be dropped. The only real problem here is that it isn't exiting 
cleanly, and this makes it impractical to integrate with a build script.

What version of the product are you using? On what operating system?

Roundhouse 0.8.5.0
Windows 7 x64 Professional
PostgreSQL 9.1.1, compiled by Visual C++ build 1500, 32-bit (Running on remote 
server)

Please provide any additional information below.

I have attached a sample that demonstrates the problem. Simply run the batch 
file. It will prompt you for the parameters necessary, or you can redirect 
stdin to a text file to answer the prompts.

I actually need to get my build working ASAP. A release with the fix would be 
ideal, but barring that, is there any guidance on how to build RoundhousE from 
source?

Original issue reported on code.google.com by mcconnel...@gmail.com on 18 Oct 2012 at 8:45

Attachments:

GoogleCodeExporter commented 8 years ago
http://teamcity.codebetter.com/viewType.html?buildTypeId=bt210&tab=buildTypeStat
usDiv - latest builds are on teamcity here. You can log in as a guest and then 
pull down the compiled bits.

Original comment by trueblu...@gmail.com on 19 Oct 2012 at 2:49

GoogleCodeExporter commented 8 years ago
Thanks. This appears to be happening in the latest version from there, too, 
although the error output is slightly different.

In the sample I provided, the output ended like this and was all green:

RoundhousE v0.8.5.0 has kicked your database (rhtest)! You are now at version 
0. All changes and backups can be found at "[removed]".
Cannot access a disposed object.
Object name: 'NpgsqlConnection'.

In the newest version, it ends like this and the error is has a red background:
RoundhousE v0.8.5.260 has kicked your database (rhtest)! You are now at version 
0. All changes and backups can be found at "[removed]".
Cannot access a disposed object.
Object name: 'NpgsqlConnection'.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'NpgsqlConnection'.
   at Npgsql.NpgsqlConnection.CheckNotDisposed()
   at Npgsql.NpgsqlConnection.get_FullState()
   at Npgsql.NpgsqlConnection.get_State()
   at roundhouse.databases.DefaultDatabase`1.dispose_connection(IConnection`1 connection)
   at roundhouse.databases.DefaultDatabase`1.Dispose()
   at roundhouse.runners.RoundhouseMigrationRunner.run()
   at roundhouse.console.Program.run_migrator(ConfigurationPropertyHolder configuration)
   at roundhouse.console.Program.Main(String[] args)

(Maybe that's just some debug output or something.)

Looks like the error is bubbling up from the call to dispose the connection, as 
the original error suggested.

I was actually asking if there's documentation anywhere for building it on my 
local machine, though, in hopes of possibly fixing it (or maybe swallowing the 
exception just for my build since it doesn't seem to be hurting anything). I've 
tried to do that before and didn't have much success. Thanks again.

Original comment by mcconnel...@gmail.com on 19 Oct 2012 at 4:27

GoogleCodeExporter commented 8 years ago
To build it, you pull the source, open a command line (in that folder) and type 
build.bat. It brings all of the required building items with it. Are you having 
trouble getting this to work?

Original comment by trueblu...@gmail.com on 19 Oct 2012 at 6:20

GoogleCodeExporter commented 8 years ago
Sorry. I tried a little earlier today, only I used zip so I could get the fully 
merged binaries.

I should've tried it before making any modifications, but that didn't occur to 
me until I read your response. The build seems to work fine with no 
modifications. A little Googling suggested this error might be a bug in Npgsql, 
so I tried dropping in a new version. It built fine, but I got ugly problems 
running it:

RoundhousE encountered an error.
System.Configuration.ConfigurationErrorsException: Failed to find or load the 
registered .Net Framework Data Provider.
   at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at roundhouse.databases.AdoNetDatabase.GetAdoNetConnection(String conn_string)
   at roundhouse.databases.AdoNetDatabase.open_connection(Boolean with_transaction)
   at roundhouse.migrators.DefaultDatabaseMigrator.open_connection(Boolean with_transaction)
   at roundhouse.runners.RoundhouseMigrationRunner.run()
Failed to find or load the registered .Net Framework Data Provider.
System.Configuration.ConfigurationErrorsException: Failed to find or load the 
registered .Net Framework Data Provider.
   at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at roundhouse.databases.AdoNetDatabase.GetAdoNetConnection(String conn_string)
   at roundhouse.databases.AdoNetDatabase.open_connection(Boolean with_transaction)
   at roundhouse.migrators.DefaultDatabaseMigrator.open_connection(Boolean with_transaction)
   at roundhouse.runners.RoundhouseMigrationRunner.run()
   at roundhouse.console.Program.run_migrator(ConfigurationPropertyHolder configuration)
   at roundhouse.console.Program.Main(String[] args)

As I'm sure you've surmised, that looks like it can't find the ADO provider for 
PostgreSQL now. I dug around in the source a little, but I couldn't track down 
where I would need to change something related to this.

Thanks for all your help.

Original comment by mcconnel...@gmail.com on 19 Oct 2012 at 7:39

GoogleCodeExporter commented 8 years ago
By "works fine", I meant "works as well as the versions I've downloaded".

Also, I shouldn't use the term "ADO" since I'm not as clear as I'd like to be 
on what it actually refers to. It should be clear I'm referring to the Npgsql 
provider library, though.

Original comment by mcconnel...@gmail.com on 19 Oct 2012 at 7:49

GoogleCodeExporter commented 8 years ago
Fyi, this source is also on github - might be better to do a pull request from 
there once you get it fixed. https://github.com/chucknorris/roundhouse 

Original comment by trueblu...@gmail.com on 19 Oct 2012 at 7:56

GoogleCodeExporter commented 8 years ago

Original comment by trueblu...@gmail.com on 19 Oct 2012 at 7:56

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/roundhouse/source/browse/trunk/product/roundhouse.datab
ases.postgresql/PostgreAdoNetProviderResolver.cs is the class you are lookign 
for.

Original comment by trueblu...@gmail.com on 19 Oct 2012 at 7:57

GoogleCodeExporter commented 8 years ago
Thanks again. I think my "ugly problem" ended up being related to my mistakenly 
using the .NET 4 version of Npgsql. Until you told me where to look, though, I 
wasn't sure if there was something else I needed to change.

Upgrading didn't fix the issue. I ended up making 
DefaultDatabase.dispose_connection protected virtual, and I overrode it in 
PostgreAdoNetProviderResolver to swallow the exception I'm getting (and ONLY 
that exception). That workaround is okay with me for now, but I imagine you 
don't want it in your repository.

If I get a chance, I'll keep looking into this.

Thanks for the help.

Original comment by mcconnel...@gmail.com on 19 Oct 2012 at 11:35

GoogleCodeExporter commented 8 years ago
I'm seeing the same thing with the latest version, 0.8.6. 

All seems to work as expected, just errors out at the end.

Original comment by st...@evenkiel.com on 2 Jun 2013 at 7:49